18c339a94Sopenharmony_ci/* 28c339a94Sopenharmony_ci * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd. 38c339a94Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 48c339a94Sopenharmony_ci * you may not use this file except in compliance with the License. 58c339a94Sopenharmony_ci * You may obtain a copy of the License at 68c339a94Sopenharmony_ci * 78c339a94Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 88c339a94Sopenharmony_ci * 98c339a94Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 108c339a94Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 118c339a94Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 128c339a94Sopenharmony_ci * See the License for the specific language governing permissions and 138c339a94Sopenharmony_ci * limitations under the License. 148c339a94Sopenharmony_ci */ 158c339a94Sopenharmony_ciimport { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; 168c339a94Sopenharmony_ci 178c339a94Sopenharmony_ciexport default function localUnitTest() { 188c339a94Sopenharmony_ci describe('localUnitTest', () => { 198c339a94Sopenharmony_ci // Defines a test suite. Two parameters are supported: test suite name and test suite function. 208c339a94Sopenharmony_ci beforeAll(() => { 218c339a94Sopenharmony_ci // Presets an action, which is performed only once before all test cases of the test suite start. 228c339a94Sopenharmony_ci // This API supports only one parameter: preset action function. 238c339a94Sopenharmony_ci }); 248c339a94Sopenharmony_ci beforeEach(() => { 258c339a94Sopenharmony_ci // Presets an action, which is performed before each unit test case starts. 268c339a94Sopenharmony_ci // The number of execution times is the same as the number of test cases defined by **it**. 278c339a94Sopenharmony_ci // This API supports only one parameter: preset action function. 288c339a94Sopenharmony_ci }); 298c339a94Sopenharmony_ci afterEach(() => { 308c339a94Sopenharmony_ci // Presets a clear action, which is performed after each unit test case ends. 318c339a94Sopenharmony_ci // The number of execution times is the same as the number of test cases defined by **it**. 328c339a94Sopenharmony_ci // This API supports only one parameter: clear action function. 338c339a94Sopenharmony_ci }); 348c339a94Sopenharmony_ci afterAll(() => { 358c339a94Sopenharmony_ci // Presets a clear action, which is performed after all test cases of the test suite end. 368c339a94Sopenharmony_ci // This API supports only one parameter: clear action function. 378c339a94Sopenharmony_ci }); 388c339a94Sopenharmony_ci it('assertContain', 0, () => { 398c339a94Sopenharmony_ci // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. 408c339a94Sopenharmony_ci let a = 'abc'; 418c339a94Sopenharmony_ci let b = 'b'; 428c339a94Sopenharmony_ci // Defines a variety of assertion methods, which are used to declare expected boolean conditions. 438c339a94Sopenharmony_ci expect(a).assertContain(b); 448c339a94Sopenharmony_ci expect(a).assertEqual(a); 458c339a94Sopenharmony_ci }); 468c339a94Sopenharmony_ci }); 478c339a94Sopenharmony_ci}