From 6d9ef1dfc6fc334732a591b3146ab6a051f9ec20 Mon Sep 17 00:00:00 2001 From: greada Date: Mon, 15 Aug 2022 10:50:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85API=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: greada --- .../src/main/js/test/thermal_unittest.test.js | 96 ++++++++++++++++--- 1 file changed, 83 insertions(+), 13 deletions(-) diff --git a/powermgr/thermal_manager/src/main/js/test/thermal_unittest.test.js b/powermgr/thermal_manager/src/main/js/test/thermal_unittest.test.js index ea47d2649..80dd56f9c 100644 --- a/powermgr/thermal_manager/src/main/js/test/thermal_unittest.test.js +++ b/powermgr/thermal_manager/src/main/js/test/thermal_unittest.test.js @@ -20,17 +20,12 @@ const MSEC_1000 = 1000; export default function ThermalUnitTest() { describe('ThermalUnitTest', function () { console.log("*************Thermal API Test Begin*************"); - test14(); - test15(); -}) - -function test14() { /* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0010 - * @tc.name Thermal_014 + * @tc.name Get_Thermal_Level_JSTest0010 * @tc.desc Thermal acquisition kit */ - it('Thermal_014', 0, async function (done) { + it('Get_Thermal_Level_JSTest0010', 0, async function (done) { console.info("enter"); await new Promise((resolve, reject) => { setTimeout(() => { @@ -42,15 +37,12 @@ function test14() { }, MSEC_1000 * 4); }) }) -} - -function test15() { /* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0020 - * @tc.name Thermal_015 + * @tc.name SubscribeAndUnsubscribe_Thermal_Level_JSTest0020 * @tc.desc Thermal acquisition kit */ - it('Thermal_015', 0, async function (done) { + it('SubscribeAndUnsubscribe_Thermal_Level_JSTest0020', 0, async function (done) { thermal.subscribeThermalLevel((level) => { console.info("level is: " + level); expect(level >= 0 && level <= 6).assertTrue(); @@ -65,4 +57,82 @@ function test15() { }, MSEC_1000 * 4); }) }) -}} + + /** + * @tc.number SUB_PowerSystem_ThermalManager_JSTest_0030 + * @tc.name Get_Thermal_Level_Cool_JSTest0030 + * @tc.desc Get device thermalLevel COOL + */ + it('Get_Thermal_Level_Cool_JSTest0030', 0, function () { + let thermalLevel = thermal.ThermalLevel.COOL; + console.info('ThermalLevel.COOL = ' + thermalLevel); + expect(thermalLevel === 0).assertTrue(); + }) + + /** + * @tc.number SUB_PowerSystem_ThermalManager_JSTest_0040 + * @tc.name Get_Thermal_Level_Normal_JSTest0040 + * @tc.desc Get device thermalLevel NORMAL + */ + it('Get_Thermal_Level_Normal_JSTest0040', 0, function () { + let thermalLevel = thermal.ThermalLevel.NORMAL; + console.info('ThermalLevel.NORMAL = ' + thermalLevel); + expect(thermalLevel === 1).assertTrue(); + }) + + /** + * @tc.number SUB_PowerSystem_ThermalManager_JSTest_0050 + * @tc.name Get_Thermal_Level_Warm_JSTest0050 + * @tc.desc Get device thermalLevel WARM + */ + it('Get_Thermal_Level_Warm_JSTest0050', 0, function () { + let thermalLevel = thermal.ThermalLevel.WARM; + console.info('ThermalLevel.WARM = ' + thermalLevel); + expect(thermalLevel === 2).assertTrue(); + }) + + /** + * @tc.number SUB_PowerSystem_ThermalManager_JSTest_0060 + * @tc.name Get_Thermal_Level_Hot_JSTest0060 + * @tc.desc Get device thermalLevel HOT + */ + it('Get_Thermal_Level_Hot_JSTest0060', 0, function () { + let thermalLevel = thermal.ThermalLevel.HOT; + console.info('ThermalLevel.HOT = ' + thermalLevel); + expect(thermalLevel === 3).assertTrue(); + }) + + /** + * @tc.number SUB_PowerSystem_ThermalManager_JSTest_0070 + * @tc.name Get_Thermal_Level_OverHeated_JSTest0070 + * @tc.desc Get device thermalLevel OVERHEATED + */ + it('Get_Thermal_Level_OverHeated_JSTest0070', 0, function () { + let thermalLevel = thermal.ThermalLevel.OVERHEATED; + console.info('ThermalLevel.OVERHEATED = ' + thermalLevel); + expect(thermalLevel === 4).assertTrue(); + }) + + /** + * @tc.number SUB_PowerSystem_ThermalManager_JSTest_0080 + * @tc.name Get_Thermal_Level_Warning_JSTest0080 + * @tc.desc Get device thermalLevel WARNING + */ + it('Get_Thermal_Level_Warning_JSTest0080', 0, function () { + let thermalLevel = thermal.ThermalLevel.WARNING; + console.info('ThermalLevel.WARNING = ' + thermalLevel); + expect(thermalLevel === 5).assertTrue(); + }) + + /** + * @tc.number SUB_PowerSystem_ThermalManager_JSTest_0090 + * @tc.name Get_Thermal_Level_Emergency_JSTest0090 + * @tc.desc Get device thermalLevel EMERGENCY + */ + it('Get_Thermal_Level_Emergency_JSTest0090', 0, function () { + let thermalLevel = thermal.ThermalLevel.EMERGENCY; + console.info('ThermalLevel.EMERGENCY = ' + thermalLevel); + expect(thermalLevel === 6).assertTrue(); + }) +}) +} -- GitLab