1import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; 2 3export default function localUnitTest() { 4 describe('localUnitTest', () => { 5 // Defines a test suite. Two parameters are supported: test suite name and test suite function. 6 beforeAll(() => { 7 // Presets an action, which is performed only once before all test cases of the test suite start. 8 // This API supports only one parameter: preset action function. 9 }); 10 beforeEach(() => { 11 // Presets an action, which is performed before each unit test case starts. 12 // The number of execution times is the same as the number of test cases defined by **it**. 13 // This API supports only one parameter: preset action function. 14 }); 15 afterEach(() => { 16 // Presets a clear action, which is performed after each unit test case ends. 17 // The number of execution times is the same as the number of test cases defined by **it**. 18 // This API supports only one parameter: clear action function. 19 }); 20 afterAll(() => { 21 // Presets a clear action, which is performed after all test cases of the test suite end. 22 // This API supports only one parameter: clear action function. 23 }); 24 it('assertContain', 0, () => { 25 // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. 26 let a = 'abc'; 27 let b = 'b'; 28 // Defines a variety of assertion methods, which are used to declare expected boolean conditions. 29 expect(a).assertContain(b); 30 expect(a).assertEqual(a); 31 }); 32 }); 33}