1/* 2 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; 16 17export default function localUnitTest() { 18 describe('localUnitTest', () => { 19 // Defines a test suite. Two parameters are supported: test suite name and test suite function. 20 beforeAll(() => { 21 // Presets an action, which is performed only once before all test cases of the test suite start. 22 // This API supports only one parameter: preset action function. 23 }); 24 beforeEach(() => { 25 // Presets an action, which is performed before each unit test case starts. 26 // The number of execution times is the same as the number of test cases defined by **it**. 27 // This API supports only one parameter: preset action function. 28 }); 29 afterEach(() => { 30 // Presets a clear action, which is performed after each unit test case ends. 31 // The number of execution times is the same as the number of test cases defined by **it**. 32 // This API supports only one parameter: clear action function. 33 }); 34 afterAll(() => { 35 // Presets a clear action, which is performed after all test cases of the test suite end. 36 // This API supports only one parameter: clear action function. 37 }); 38 it('assertContain', 0, () => { 39 // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. 40 let a = 'abc'; 41 let b = 'b'; 42 // Defines a variety of assertion methods, which are used to declare expected boolean conditions. 43 expect(a).assertContain(b); 44 expect(a).assertEqual(a); 45 }); 46 }); 47}