提交 0d16d76d 编写于 作者: L logic42

change testcase

Signed-off-by: Nlogic42 <wanglong108@huawei.com>
上级 1e9c089f
...@@ -73,7 +73,7 @@ describe('MultimodalInput_test', function () { ...@@ -73,7 +73,7 @@ describe('MultimodalInput_test', function () {
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
let arr = []; let arr = [];
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
inputDevice.getDevice(data[i], (res, err) => { inputDevice.getDevice(data[i], (res, err) => {
console.log(`getDevice:data_i ${JSON.stringify(data[i])}`) console.log(`getDevice:data_i ${JSON.stringify(data[i])}`)
console.log(`getDevice:data ${JSON.stringify(data)}`) console.log(`getDevice:data ${JSON.stringify(data)}`)
...@@ -94,7 +94,7 @@ describe('MultimodalInput_test', function () { ...@@ -94,7 +94,7 @@ describe('MultimodalInput_test', function () {
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
let arr = []; let arr = [];
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
inputDevice.getDevice(data[i], (res, err) => { inputDevice.getDevice(data[i], (res, err) => {
console.log(`getDevice:data_i ${JSON.stringify(data[i])}`) console.log(`getDevice:data_i ${JSON.stringify(data[i])}`)
console.log(`getDevice:data ${JSON.stringify(data)}`) console.log(`getDevice:data ${JSON.stringify(data)}`)
......
...@@ -17,7 +17,7 @@ import app from '@system.app' ...@@ -17,7 +17,7 @@ import app from '@system.app'
import Context from '@ohos.napi_context' import Context from '@ohos.napi_context'
import batteryInfo from '@ohos.batteryInfo'; import batteryInfo from '@ohos.batteryInfo';
import brightness from '@ohos.brightness'; import brightness from '@ohos.brightness';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('appInfoTest', function () { describe('appInfoTest', function () {
console.log("*************Battery Unit Test Begin*************"); console.log("*************Battery Unit Test Begin*************");
...@@ -28,7 +28,7 @@ describe('appInfoTest', function () { ...@@ -28,7 +28,7 @@ describe('appInfoTest', function () {
* @tc.desc Battery acquisition kit * @tc.desc Battery acquisition kit
*/ */
it('battery_soc_test', 0, function () { it('battery_soc_test', 0, function () {
var batterySoc = batteryInfo.batterySOC; let batterySoc = batteryInfo.batterySOC;
console.info('batterySoc = ' + batterySoc); console.info('batterySoc = ' + batterySoc);
expect(batterySoc >= -1 && batterySoc <= 100).assertTrue() expect(batterySoc >= -1 && batterySoc <= 100).assertTrue()
}) })
...@@ -39,7 +39,7 @@ describe('appInfoTest', function () { ...@@ -39,7 +39,7 @@ describe('appInfoTest', function () {
* @tc.desc Battery charging kit * @tc.desc Battery charging kit
*/ */
it('charging_status_test', 0, function () { it('charging_status_test', 0, function () {
var chargingStatus = batteryInfo.chargingStatus; let chargingStatus = batteryInfo.chargingStatus;
console.info('chargingStatus = ' + chargingStatus); console.info('chargingStatus = ' + chargingStatus);
expect(chargingStatus >= 0 && chargingStatus <= 4).assertTrue() expect(chargingStatus >= 0 && chargingStatus <= 4).assertTrue()
}) })
...@@ -50,7 +50,7 @@ describe('appInfoTest', function () { ...@@ -50,7 +50,7 @@ describe('appInfoTest', function () {
* @tc.desc Get Battery Health Get KIT * @tc.desc Get Battery Health Get KIT
*/ */
it('health_status_test', 0, function () { it('health_status_test', 0, function () {
var healthStatus = batteryInfo.healthStatus; let healthStatus = batteryInfo.healthStatus;
console.info('healthStatus = ' + healthStatus); console.info('healthStatus = ' + healthStatus);
expect(healthStatus >= 0 && healthStatus <= 6).assertTrue() expect(healthStatus >= 0 && healthStatus <= 6).assertTrue()
}) })
...@@ -61,7 +61,7 @@ describe('appInfoTest', function () { ...@@ -61,7 +61,7 @@ describe('appInfoTest', function () {
* @tc.desc Obtaining the USB Connection Type KIT * @tc.desc Obtaining the USB Connection Type KIT
*/ */
it('plugged_type_test', 0, function () { it('plugged_type_test', 0, function () {
var pluggedType = batteryInfo.pluggedType; let pluggedType = batteryInfo.pluggedType;
console.info('pluggedType = ' + pluggedType); console.info('pluggedType = ' + pluggedType);
expect(pluggedType >= 0 && pluggedType <= 4).assertTrue() expect(pluggedType >= 0 && pluggedType <= 4).assertTrue()
}) })
...@@ -72,7 +72,7 @@ describe('appInfoTest', function () { ...@@ -72,7 +72,7 @@ describe('appInfoTest', function () {
* @tc.desc Obtaining the Voltage Interface KIT * @tc.desc Obtaining the Voltage Interface KIT
*/ */
it('voltage_test', 0, function () { it('voltage_test', 0, function () {
var voltage = batteryInfo.voltage; let voltage = batteryInfo.voltage;
console.info('voltage = ' + voltage); console.info('voltage = ' + voltage);
expect(voltage >= -1).assertTrue() expect(voltage >= -1).assertTrue()
}) })
...@@ -83,7 +83,7 @@ describe('appInfoTest', function () { ...@@ -83,7 +83,7 @@ describe('appInfoTest', function () {
* @tc.desc Obtaining the Battery Technology Interface KIT * @tc.desc Obtaining the Battery Technology Interface KIT
*/ */
it('technology_test', 0, function () { it('technology_test', 0, function () {
var technology = batteryInfo.technology; let technology = batteryInfo.technology;
console.info('technology = ' + technology); console.info('technology = ' + technology);
expect(technology !== null).assertTrue() expect(technology !== null).assertTrue()
}) })
...@@ -94,7 +94,7 @@ describe('appInfoTest', function () { ...@@ -94,7 +94,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryTemperature values Interface Test * @tc.desc BatteryTemperature values Interface Test
*/ */
it('battery_temperature_test', 0, function () { it('battery_temperature_test', 0, function () {
var batteryTemperature = batteryInfo.batteryTemperature; let batteryTemperature = batteryInfo.batteryTemperature;
console.info('batteryTemperature = ' + batteryTemperature); console.info('batteryTemperature = ' + batteryTemperature);
expect(batteryTemperature <= 700).assertTrue() expect(batteryTemperature <= 700).assertTrue()
}) })
...@@ -105,7 +105,7 @@ describe('appInfoTest', function () { ...@@ -105,7 +105,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryHealthState values Interface Test * @tc.desc BatteryHealthState values Interface Test
*/ */
it('enum_health_state_test_unknown', 0, function () { it('enum_health_state_test_unknown', 0, function () {
var batteryHealthState = batteryInfo.BatteryHealthState.UNKNOWN; let batteryHealthState = batteryInfo.BatteryHealthState.UNKNOWN;
console.info('batteryHealthState = ' + batteryHealthState); console.info('batteryHealthState = ' + batteryHealthState);
expect(batteryHealthState == 0).assertTrue() expect(batteryHealthState == 0).assertTrue()
}) })
...@@ -116,7 +116,7 @@ describe('appInfoTest', function () { ...@@ -116,7 +116,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryHealthState values Interface Test * @tc.desc BatteryHealthState values Interface Test
*/ */
it('enum_health_state_test_good', 0, function () { it('enum_health_state_test_good', 0, function () {
var batteryHealthState = batteryInfo.BatteryHealthState.GOOD; let batteryHealthState = batteryInfo.BatteryHealthState.GOOD;
console.info('batteryHealthState = ' + batteryHealthState); console.info('batteryHealthState = ' + batteryHealthState);
expect(batteryHealthState == 1).assertTrue() expect(batteryHealthState == 1).assertTrue()
}) })
...@@ -127,7 +127,7 @@ describe('appInfoTest', function () { ...@@ -127,7 +127,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryHealthState values Interface Test * @tc.desc BatteryHealthState values Interface Test
*/ */
it('enum_health_state_test_overheat', 0, function () { it('enum_health_state_test_overheat', 0, function () {
var batteryHealthState = batteryInfo.BatteryHealthState.OVERHEAT; let batteryHealthState = batteryInfo.BatteryHealthState.OVERHEAT;
console.info('batteryHealthState = ' + batteryHealthState); console.info('batteryHealthState = ' + batteryHealthState);
expect(batteryHealthState == 2).assertTrue() expect(batteryHealthState == 2).assertTrue()
}) })
...@@ -138,7 +138,7 @@ describe('appInfoTest', function () { ...@@ -138,7 +138,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryHealthState values Interface Test * @tc.desc BatteryHealthState values Interface Test
*/ */
it('enum_health_state_test_overvoltage', 0, function () { it('enum_health_state_test_overvoltage', 0, function () {
var batteryHealthState = batteryInfo.BatteryHealthState.OVERVOLTAGE; let batteryHealthState = batteryInfo.BatteryHealthState.OVERVOLTAGE;
console.info('batteryHealthState = ' + batteryHealthState); console.info('batteryHealthState = ' + batteryHealthState);
expect(batteryHealthState == 3).assertTrue() expect(batteryHealthState == 3).assertTrue()
}) })
...@@ -149,7 +149,7 @@ describe('appInfoTest', function () { ...@@ -149,7 +149,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryHealthState values Interface Test * @tc.desc BatteryHealthState values Interface Test
*/ */
it('enum_health_state_test_cold', 0, function () { it('enum_health_state_test_cold', 0, function () {
var batteryHealthState = batteryInfo.BatteryHealthState.COLD; let batteryHealthState = batteryInfo.BatteryHealthState.COLD;
console.info('batteryHealthState = ' + batteryHealthState); console.info('batteryHealthState = ' + batteryHealthState);
expect(batteryHealthState == 4).assertTrue() expect(batteryHealthState == 4).assertTrue()
}) })
...@@ -160,7 +160,7 @@ describe('appInfoTest', function () { ...@@ -160,7 +160,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryHealthState values Interface Test * @tc.desc BatteryHealthState values Interface Test
*/ */
it('enum_health_state_test_dead', 0, function () { it('enum_health_state_test_dead', 0, function () {
var batteryHealthState = batteryInfo.BatteryHealthState.DEAD; let batteryHealthState = batteryInfo.BatteryHealthState.DEAD;
console.info('batteryHealthState = ' + batteryHealthState); console.info('batteryHealthState = ' + batteryHealthState);
expect(batteryHealthState == 5).assertTrue() expect(batteryHealthState == 5).assertTrue()
}) })
...@@ -171,7 +171,7 @@ describe('appInfoTest', function () { ...@@ -171,7 +171,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryChargeState values Interface Test * @tc.desc BatteryChargeState values Interface Test
*/ */
it('enum_charge_state_test_none', 0, function () { it('enum_charge_state_test_none', 0, function () {
var batteryChargeState = batteryInfo.BatteryChargeState.NONE; let batteryChargeState = batteryInfo.BatteryChargeState.NONE;
console.info('batteryChargeState = ' + batteryChargeState); console.info('batteryChargeState = ' + batteryChargeState);
expect(batteryChargeState == 0).assertTrue() expect(batteryChargeState == 0).assertTrue()
}) })
...@@ -182,7 +182,7 @@ describe('appInfoTest', function () { ...@@ -182,7 +182,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryChargeState values Interface Test * @tc.desc BatteryChargeState values Interface Test
*/ */
it('enum_charge_state_test_enable', 0, function () { it('enum_charge_state_test_enable', 0, function () {
var batteryChargeState = batteryInfo.BatteryChargeState.ENABLE; let batteryChargeState = batteryInfo.BatteryChargeState.ENABLE;
console.info('batteryChargeState = ' + batteryChargeState); console.info('batteryChargeState = ' + batteryChargeState);
expect(batteryChargeState == 1).assertTrue() expect(batteryChargeState == 1).assertTrue()
}) })
...@@ -193,7 +193,7 @@ describe('appInfoTest', function () { ...@@ -193,7 +193,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryChargeState values Interface Test * @tc.desc BatteryChargeState values Interface Test
*/ */
it('enum_charge_state_test_disable', 0, function () { it('enum_charge_state_test_disable', 0, function () {
var batteryChargeState = batteryInfo.BatteryChargeState.DISABLE; let batteryChargeState = batteryInfo.BatteryChargeState.DISABLE;
console.info('batteryChargeState = ' + batteryChargeState); console.info('batteryChargeState = ' + batteryChargeState);
expect(batteryChargeState == 2).assertTrue() expect(batteryChargeState == 2).assertTrue()
}) })
...@@ -204,7 +204,7 @@ describe('appInfoTest', function () { ...@@ -204,7 +204,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryChargeState values Interface Test * @tc.desc BatteryChargeState values Interface Test
*/ */
it('enum_charge_state_test_full', 0, function () { it('enum_charge_state_test_full', 0, function () {
var batteryChargeState = batteryInfo.BatteryChargeState.FULL; let batteryChargeState = batteryInfo.BatteryChargeState.FULL;
console.info('batteryChargeState = ' + batteryChargeState); console.info('batteryChargeState = ' + batteryChargeState);
expect(batteryChargeState == 3).assertTrue() expect(batteryChargeState == 3).assertTrue()
}) })
...@@ -215,7 +215,7 @@ describe('appInfoTest', function () { ...@@ -215,7 +215,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryPluggedType values Interface Test * @tc.desc BatteryPluggedType values Interface Test
*/ */
it('enum_plugged_type_test_none', 0, function () { it('enum_plugged_type_test_none', 0, function () {
var batteryPluggedType = batteryInfo.BatteryPluggedType.NONE; let batteryPluggedType = batteryInfo.BatteryPluggedType.NONE;
console.info('batteryPluggedType = ' + batteryPluggedType); console.info('batteryPluggedType = ' + batteryPluggedType);
expect(batteryPluggedType == 0).assertTrue() expect(batteryPluggedType == 0).assertTrue()
}) })
...@@ -226,7 +226,7 @@ describe('appInfoTest', function () { ...@@ -226,7 +226,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryPluggedType values Interface Test * @tc.desc BatteryPluggedType values Interface Test
*/ */
it('enum_plugged_type_test_ac', 0, function () { it('enum_plugged_type_test_ac', 0, function () {
var batteryPluggedType = batteryInfo.BatteryPluggedType.AC; let batteryPluggedType = batteryInfo.BatteryPluggedType.AC;
console.info('batteryPluggedType = ' + batteryPluggedType); console.info('batteryPluggedType = ' + batteryPluggedType);
expect(batteryPluggedType == 1).assertTrue() expect(batteryPluggedType == 1).assertTrue()
}) })
...@@ -237,7 +237,7 @@ describe('appInfoTest', function () { ...@@ -237,7 +237,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryPluggedType values Interface Test * @tc.desc BatteryPluggedType values Interface Test
*/ */
it('enum_plugged_type_test_usb', 0, function () { it('enum_plugged_type_test_usb', 0, function () {
var batteryPluggedType = batteryInfo.BatteryPluggedType.USB; let batteryPluggedType = batteryInfo.BatteryPluggedType.USB;
console.info('batteryPluggedType = ' + batteryPluggedType); console.info('batteryPluggedType = ' + batteryPluggedType);
expect(batteryPluggedType == 2).assertTrue() expect(batteryPluggedType == 2).assertTrue()
}) })
...@@ -248,7 +248,7 @@ describe('appInfoTest', function () { ...@@ -248,7 +248,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryPluggedType values Interface Test * @tc.desc BatteryPluggedType values Interface Test
*/ */
it('enum_plugged_type_test_wireless', 0, function () { it('enum_plugged_type_test_wireless', 0, function () {
var batteryPluggedType = batteryInfo.BatteryPluggedType.WIRELESS; let batteryPluggedType = batteryInfo.BatteryPluggedType.WIRELESS;
console.info('batteryPluggedType = ' + batteryPluggedType); console.info('batteryPluggedType = ' + batteryPluggedType);
expect(batteryPluggedType == 3).assertTrue() expect(batteryPluggedType == 3).assertTrue()
}) })
...@@ -271,11 +271,11 @@ describe('appInfoTest', function () { ...@@ -271,11 +271,11 @@ describe('appInfoTest', function () {
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
it('is_battery_present_test', 0, function () { it('is_battery_present_test', 0, function () {
var isBatteryPresent = batteryInfo.isBatteryPresent; let isBatteryPresent = batteryInfo.isBatteryPresent;
console.info('isBatteryPresent = ' + isBatteryPresent); console.info('isBatteryPresent = ' + isBatteryPresent);
if (isBatteryPresent) { if (isBatteryPresent) {
expect(isBatteryPresent).assertTrue(); expect(isBatteryPresent).assertTrue();
}else{ } else {
expect(isBatteryPresent).assertFalse(); expect(isBatteryPresent).assertFalse();
} }
}) })
......
...@@ -19,7 +19,7 @@ import runningLock from '@ohos.runningLock'; ...@@ -19,7 +19,7 @@ import runningLock from '@ohos.runningLock';
import power from '@ohos.power'; import power from '@ohos.power';
import '@ohos.permission.RUNNING_LOCK' import '@ohos.permission.RUNNING_LOCK'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('appInfoTest', function () { describe('appInfoTest', function () {
console.log("*************Power Unit Test Begin*************"); console.log("*************Power Unit Test Begin*************");
...@@ -43,7 +43,7 @@ describe('appInfoTest', function () { ...@@ -43,7 +43,7 @@ describe('appInfoTest', function () {
if (typeof error === "undefined") { if (typeof error === "undefined") {
console.info('create_running_lock_callback_test: runningLock is ' + runninglock); console.info('create_running_lock_callback_test: runningLock is ' + runninglock);
expect(runninglock !== null).assertTrue(); expect(runninglock !== null).assertTrue();
var used = runninglock.isUsed(); let used = runninglock.isUsed();
console.info('create_running_lock_callback_test is used: ' + used); console.info('create_running_lock_callback_test is used: ' + used);
expect(used).assertFalse(); expect(used).assertFalse();
runninglock.lock(500); runninglock.lock(500);
...@@ -64,7 +64,7 @@ describe('appInfoTest', function () { ...@@ -64,7 +64,7 @@ describe('appInfoTest', function () {
runningLock.createRunningLock("running_lock_test_3", runningLock.RunningLockType.BACKGROUND) runningLock.createRunningLock("running_lock_test_3", runningLock.RunningLockType.BACKGROUND)
.then(runninglock => { .then(runninglock => {
expect(runninglock !== null).assertTrue(); expect(runninglock !== null).assertTrue();
var used = runninglock.isUsed(); let used = runninglock.isUsed();
console.info('running_lock_lock_test is used: ' + used); console.info('running_lock_lock_test is used: ' + used);
expect(used).assertFalse(); expect(used).assertFalse();
runninglock.lock(500); runninglock.lock(500);
...@@ -85,7 +85,7 @@ describe('appInfoTest', function () { ...@@ -85,7 +85,7 @@ describe('appInfoTest', function () {
runningLock.createRunningLock("running_lock_test_4", runningLock.RunningLockType.BACKGROUND) runningLock.createRunningLock("running_lock_test_4", runningLock.RunningLockType.BACKGROUND)
.then(runninglock => { .then(runninglock => {
expect(runninglock !== null).assertTrue(); expect(runninglock !== null).assertTrue();
var used = runninglock.isUsed(); let used = runninglock.isUsed();
console.info('running_lock_isused_test used: ' + used); console.info('running_lock_isused_test used: ' + used);
expect(used).assertFalse(); expect(used).assertFalse();
console.info('running_lock_isused_test success'); console.info('running_lock_isused_test success');
...@@ -102,7 +102,7 @@ describe('appInfoTest', function () { ...@@ -102,7 +102,7 @@ describe('appInfoTest', function () {
runningLock.createRunningLock("running_lock_test_5", runningLock.RunningLockType.BACKGROUND) runningLock.createRunningLock("running_lock_test_5", runningLock.RunningLockType.BACKGROUND)
.then(runninglock => { .then(runninglock => {
expect(runninglock !== null).assertTrue(); expect(runninglock !== null).assertTrue();
var used = runninglock.isUsed(); let used = runninglock.isUsed();
console.info('running_lock_unlock_test is used: ' + used); console.info('running_lock_unlock_test is used: ' + used);
expect(used).assertFalse(); expect(used).assertFalse();
runninglock.lock(500); runninglock.lock(500);
...@@ -124,14 +124,14 @@ describe('appInfoTest', function () { ...@@ -124,14 +124,14 @@ describe('appInfoTest', function () {
}) })
//Runninglock锁的类型为BACKGROUND //Runninglock锁的类型为BACKGROUND
it('enum_runningLock_type_background_test', 0, function () { it('enum_runningLock_type_background_test', 0, function () {
var runningLockType = runningLock.RunningLockType.BACKGROUND; let runningLockType = runningLock.RunningLockType.BACKGROUND;
console.info('runningLockType = ' + runningLockType); console.info('runningLockType = ' + runningLockType);
expect(runningLockType == 1).assertTrue(); expect(runningLockType == 1).assertTrue();
console.info('enum_runningLock_type_background_test success'); console.info('enum_runningLock_type_background_test success');
}) })
//Runninglock锁的类型为PROXIMITY_SCREEN_CONTROL //Runninglock锁的类型为PROXIMITY_SCREEN_CONTROL
it('enum_runningLock_type_proximityscreencontrol_test', 0, function () { it('enum_runningLock_type_proximityscreencontrol_test', 0, function () {
var runningLockType = runningLock.RunningLockType.PROXIMITY_SCREEN_CONTROL; let runningLockType = runningLock.RunningLockType.PROXIMITY_SCREEN_CONTROL;
console.info('runningLockType = ' + runningLockType); console.info('runningLockType = ' + runningLockType);
expect(runningLockType == 2).assertTrue(); expect(runningLockType == 2).assertTrue();
console.info('enum_runningLock_type_proximityscreencontrol_test success'); console.info('enum_runningLock_type_proximityscreencontrol_test success');
......
...@@ -17,7 +17,7 @@ import app from '@system.app' ...@@ -17,7 +17,7 @@ import app from '@system.app'
import Context from '@ohos.napi_context' import Context from '@ohos.napi_context'
import batteryInfo from '@ohos.batteryInfo'; import batteryInfo from '@ohos.batteryInfo';
import brightness from '@ohos.brightness'; import brightness from '@ohos.brightness';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('appInfoTest', function () { describe('appInfoTest', function () {
console.log("*************Battery Unit Test Begin*************"); console.log("*************Battery Unit Test Begin*************");
...@@ -28,7 +28,7 @@ describe('appInfoTest', function () { ...@@ -28,7 +28,7 @@ describe('appInfoTest', function () {
* @tc.desc Battery acquisition kit * @tc.desc Battery acquisition kit
*/ */
it('battery_soc_test', 0, function () { it('battery_soc_test', 0, function () {
var batterySoc = batteryInfo.batterySOC; let batterySoc = batteryInfo.batterySOC;
console.info('batterySoc = ' + batterySoc); console.info('batterySoc = ' + batterySoc);
expect(batterySoc >= -1 && batterySoc <= 100).assertTrue() expect(batterySoc >= -1 && batterySoc <= 100).assertTrue()
}) })
...@@ -39,7 +39,7 @@ describe('appInfoTest', function () { ...@@ -39,7 +39,7 @@ describe('appInfoTest', function () {
* @tc.desc Battery charging kit * @tc.desc Battery charging kit
*/ */
it('charging_status_test', 0, function () { it('charging_status_test', 0, function () {
var chargingStatus = batteryInfo.chargingStatus; let chargingStatus = batteryInfo.chargingStatus;
console.info('chargingStatus = ' + chargingStatus); console.info('chargingStatus = ' + chargingStatus);
expect(chargingStatus >= 0 && chargingStatus <= 4).assertTrue() expect(chargingStatus >= 0 && chargingStatus <= 4).assertTrue()
}) })
...@@ -50,7 +50,7 @@ describe('appInfoTest', function () { ...@@ -50,7 +50,7 @@ describe('appInfoTest', function () {
* @tc.desc Get Battery Health Get KIT * @tc.desc Get Battery Health Get KIT
*/ */
it('health_status_test', 0, function () { it('health_status_test', 0, function () {
var healthStatus = batteryInfo.healthStatus; let healthStatus = batteryInfo.healthStatus;
console.info('healthStatus = ' + healthStatus); console.info('healthStatus = ' + healthStatus);
expect(healthStatus >= 0 && healthStatus <= 6).assertTrue() expect(healthStatus >= 0 && healthStatus <= 6).assertTrue()
}) })
...@@ -61,7 +61,7 @@ describe('appInfoTest', function () { ...@@ -61,7 +61,7 @@ describe('appInfoTest', function () {
* @tc.desc Obtaining the USB Connection Type KIT * @tc.desc Obtaining the USB Connection Type KIT
*/ */
it('plugged_type_test', 0, function () { it('plugged_type_test', 0, function () {
var pluggedType = batteryInfo.pluggedType; let pluggedType = batteryInfo.pluggedType;
console.info('pluggedType = ' + pluggedType); console.info('pluggedType = ' + pluggedType);
expect(pluggedType >= 0 && pluggedType <= 4).assertTrue() expect(pluggedType >= 0 && pluggedType <= 4).assertTrue()
}) })
...@@ -72,7 +72,7 @@ describe('appInfoTest', function () { ...@@ -72,7 +72,7 @@ describe('appInfoTest', function () {
* @tc.desc Obtaining the Voltage Interface KIT * @tc.desc Obtaining the Voltage Interface KIT
*/ */
it('voltage_test', 0, function () { it('voltage_test', 0, function () {
var voltage = batteryInfo.voltage; let voltage = batteryInfo.voltage;
console.info('voltage = ' + voltage); console.info('voltage = ' + voltage);
expect(voltage >= -1).assertTrue() expect(voltage >= -1).assertTrue()
}) })
...@@ -83,7 +83,7 @@ describe('appInfoTest', function () { ...@@ -83,7 +83,7 @@ describe('appInfoTest', function () {
* @tc.desc Obtaining the Battery Technology Interface KIT * @tc.desc Obtaining the Battery Technology Interface KIT
*/ */
it('technology_test', 0, function () { it('technology_test', 0, function () {
var technology = batteryInfo.technology; let technology = batteryInfo.technology;
console.info('technology = ' + technology); console.info('technology = ' + technology);
expect(technology !== null).assertTrue() expect(technology !== null).assertTrue()
}) })
...@@ -94,7 +94,7 @@ describe('appInfoTest', function () { ...@@ -94,7 +94,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryTemperature values Interface Test * @tc.desc BatteryTemperature values Interface Test
*/ */
it('battery_temperature_test', 0, function () { it('battery_temperature_test', 0, function () {
var batteryTemperature = batteryInfo.batteryTemperature; let batteryTemperature = batteryInfo.batteryTemperature;
console.info('batteryTemperature = ' + batteryTemperature); console.info('batteryTemperature = ' + batteryTemperature);
expect(batteryTemperature <= 700).assertTrue() expect(batteryTemperature <= 700).assertTrue()
}) })
...@@ -105,7 +105,7 @@ describe('appInfoTest', function () { ...@@ -105,7 +105,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryHealthState values Interface Test * @tc.desc BatteryHealthState values Interface Test
*/ */
it('enum_health_state_test_unknown', 0, function () { it('enum_health_state_test_unknown', 0, function () {
var batteryHealthState = batteryInfo.BatteryHealthState.UNKNOWN; let batteryHealthState = batteryInfo.BatteryHealthState.UNKNOWN;
console.info('batteryHealthState = ' + batteryHealthState); console.info('batteryHealthState = ' + batteryHealthState);
expect(batteryHealthState == 0).assertTrue() expect(batteryHealthState == 0).assertTrue()
}) })
...@@ -116,7 +116,7 @@ describe('appInfoTest', function () { ...@@ -116,7 +116,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryHealthState values Interface Test * @tc.desc BatteryHealthState values Interface Test
*/ */
it('enum_health_state_test_good', 0, function () { it('enum_health_state_test_good', 0, function () {
var batteryHealthState = batteryInfo.BatteryHealthState.GOOD; let batteryHealthState = batteryInfo.BatteryHealthState.GOOD;
console.info('batteryHealthState = ' + batteryHealthState); console.info('batteryHealthState = ' + batteryHealthState);
expect(batteryHealthState == 1).assertTrue() expect(batteryHealthState == 1).assertTrue()
}) })
...@@ -127,7 +127,7 @@ describe('appInfoTest', function () { ...@@ -127,7 +127,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryHealthState values Interface Test * @tc.desc BatteryHealthState values Interface Test
*/ */
it('enum_health_state_test_overheat', 0, function () { it('enum_health_state_test_overheat', 0, function () {
var batteryHealthState = batteryInfo.BatteryHealthState.OVERHEAT; let batteryHealthState = batteryInfo.BatteryHealthState.OVERHEAT;
console.info('batteryHealthState = ' + batteryHealthState); console.info('batteryHealthState = ' + batteryHealthState);
expect(batteryHealthState == 2).assertTrue() expect(batteryHealthState == 2).assertTrue()
}) })
...@@ -138,7 +138,7 @@ describe('appInfoTest', function () { ...@@ -138,7 +138,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryHealthState values Interface Test * @tc.desc BatteryHealthState values Interface Test
*/ */
it('enum_health_state_test_overvoltage', 0, function () { it('enum_health_state_test_overvoltage', 0, function () {
var batteryHealthState = batteryInfo.BatteryHealthState.OVERVOLTAGE; let batteryHealthState = batteryInfo.BatteryHealthState.OVERVOLTAGE;
console.info('batteryHealthState = ' + batteryHealthState); console.info('batteryHealthState = ' + batteryHealthState);
expect(batteryHealthState == 3).assertTrue() expect(batteryHealthState == 3).assertTrue()
}) })
...@@ -149,7 +149,7 @@ describe('appInfoTest', function () { ...@@ -149,7 +149,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryHealthState values Interface Test * @tc.desc BatteryHealthState values Interface Test
*/ */
it('enum_health_state_test_cold', 0, function () { it('enum_health_state_test_cold', 0, function () {
var batteryHealthState = batteryInfo.BatteryHealthState.COLD; let batteryHealthState = batteryInfo.BatteryHealthState.COLD;
console.info('batteryHealthState = ' + batteryHealthState); console.info('batteryHealthState = ' + batteryHealthState);
expect(batteryHealthState == 4).assertTrue() expect(batteryHealthState == 4).assertTrue()
}) })
...@@ -160,7 +160,7 @@ describe('appInfoTest', function () { ...@@ -160,7 +160,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryHealthState values Interface Test * @tc.desc BatteryHealthState values Interface Test
*/ */
it('enum_health_state_test_dead', 0, function () { it('enum_health_state_test_dead', 0, function () {
var batteryHealthState = batteryInfo.BatteryHealthState.DEAD; let batteryHealthState = batteryInfo.BatteryHealthState.DEAD;
console.info('batteryHealthState = ' + batteryHealthState); console.info('batteryHealthState = ' + batteryHealthState);
expect(batteryHealthState == 5).assertTrue() expect(batteryHealthState == 5).assertTrue()
}) })
...@@ -171,7 +171,7 @@ describe('appInfoTest', function () { ...@@ -171,7 +171,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryChargeState values Interface Test * @tc.desc BatteryChargeState values Interface Test
*/ */
it('enum_charge_state_test_none', 0, function () { it('enum_charge_state_test_none', 0, function () {
var batteryChargeState = batteryInfo.BatteryChargeState.NONE; let batteryChargeState = batteryInfo.BatteryChargeState.NONE;
console.info('batteryChargeState = ' + batteryChargeState); console.info('batteryChargeState = ' + batteryChargeState);
expect(batteryChargeState == 0).assertTrue() expect(batteryChargeState == 0).assertTrue()
}) })
...@@ -182,7 +182,7 @@ describe('appInfoTest', function () { ...@@ -182,7 +182,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryChargeState values Interface Test * @tc.desc BatteryChargeState values Interface Test
*/ */
it('enum_charge_state_test_enable', 0, function () { it('enum_charge_state_test_enable', 0, function () {
var batteryChargeState = batteryInfo.BatteryChargeState.ENABLE; let batteryChargeState = batteryInfo.BatteryChargeState.ENABLE;
console.info('batteryChargeState = ' + batteryChargeState); console.info('batteryChargeState = ' + batteryChargeState);
expect(batteryChargeState == 1).assertTrue() expect(batteryChargeState == 1).assertTrue()
}) })
...@@ -193,7 +193,7 @@ describe('appInfoTest', function () { ...@@ -193,7 +193,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryChargeState values Interface Test * @tc.desc BatteryChargeState values Interface Test
*/ */
it('enum_charge_state_test_disable', 0, function () { it('enum_charge_state_test_disable', 0, function () {
var batteryChargeState = batteryInfo.BatteryChargeState.DISABLE; let batteryChargeState = batteryInfo.BatteryChargeState.DISABLE;
console.info('batteryChargeState = ' + batteryChargeState); console.info('batteryChargeState = ' + batteryChargeState);
expect(batteryChargeState == 2).assertTrue() expect(batteryChargeState == 2).assertTrue()
}) })
...@@ -204,7 +204,7 @@ describe('appInfoTest', function () { ...@@ -204,7 +204,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryChargeState values Interface Test * @tc.desc BatteryChargeState values Interface Test
*/ */
it('enum_charge_state_test_full', 0, function () { it('enum_charge_state_test_full', 0, function () {
var batteryChargeState = batteryInfo.BatteryChargeState.FULL; let batteryChargeState = batteryInfo.BatteryChargeState.FULL;
console.info('batteryChargeState = ' + batteryChargeState); console.info('batteryChargeState = ' + batteryChargeState);
expect(batteryChargeState == 3).assertTrue() expect(batteryChargeState == 3).assertTrue()
}) })
...@@ -215,7 +215,7 @@ describe('appInfoTest', function () { ...@@ -215,7 +215,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryPluggedType values Interface Test * @tc.desc BatteryPluggedType values Interface Test
*/ */
it('enum_plugged_type_test_none', 0, function () { it('enum_plugged_type_test_none', 0, function () {
var batteryPluggedType = batteryInfo.BatteryPluggedType.NONE; let batteryPluggedType = batteryInfo.BatteryPluggedType.NONE;
console.info('batteryPluggedType = ' + batteryPluggedType); console.info('batteryPluggedType = ' + batteryPluggedType);
expect(batteryPluggedType == 0).assertTrue() expect(batteryPluggedType == 0).assertTrue()
}) })
...@@ -226,7 +226,7 @@ describe('appInfoTest', function () { ...@@ -226,7 +226,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryPluggedType values Interface Test * @tc.desc BatteryPluggedType values Interface Test
*/ */
it('enum_plugged_type_test_ac', 0, function () { it('enum_plugged_type_test_ac', 0, function () {
var batteryPluggedType = batteryInfo.BatteryPluggedType.AC; let batteryPluggedType = batteryInfo.BatteryPluggedType.AC;
console.info('batteryPluggedType = ' + batteryPluggedType); console.info('batteryPluggedType = ' + batteryPluggedType);
expect(batteryPluggedType == 1).assertTrue() expect(batteryPluggedType == 1).assertTrue()
}) })
...@@ -237,7 +237,7 @@ describe('appInfoTest', function () { ...@@ -237,7 +237,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryPluggedType values Interface Test * @tc.desc BatteryPluggedType values Interface Test
*/ */
it('enum_plugged_type_test_usb', 0, function () { it('enum_plugged_type_test_usb', 0, function () {
var batteryPluggedType = batteryInfo.BatteryPluggedType.USB; let batteryPluggedType = batteryInfo.BatteryPluggedType.USB;
console.info('batteryPluggedType = ' + batteryPluggedType); console.info('batteryPluggedType = ' + batteryPluggedType);
expect(batteryPluggedType == 2).assertTrue() expect(batteryPluggedType == 2).assertTrue()
}) })
...@@ -248,7 +248,7 @@ describe('appInfoTest', function () { ...@@ -248,7 +248,7 @@ describe('appInfoTest', function () {
* @tc.desc BatteryPluggedType values Interface Test * @tc.desc BatteryPluggedType values Interface Test
*/ */
it('enum_plugged_type_test_wireless', 0, function () { it('enum_plugged_type_test_wireless', 0, function () {
var batteryPluggedType = batteryInfo.BatteryPluggedType.WIRELESS; let batteryPluggedType = batteryInfo.BatteryPluggedType.WIRELESS;
console.info('batteryPluggedType = ' + batteryPluggedType); console.info('batteryPluggedType = ' + batteryPluggedType);
expect(batteryPluggedType == 3).assertTrue() expect(batteryPluggedType == 3).assertTrue()
}) })
...@@ -271,11 +271,11 @@ describe('appInfoTest', function () { ...@@ -271,11 +271,11 @@ describe('appInfoTest', function () {
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
it('is_battery_present_test', 0, function () { it('is_battery_present_test', 0, function () {
var isBatteryPresent = batteryInfo.isBatteryPresent; let isBatteryPresent = batteryInfo.isBatteryPresent;
console.info('isBatteryPresent = ' + isBatteryPresent); console.info('isBatteryPresent = ' + isBatteryPresent);
if (isBatteryPresent) { if (isBatteryPresent) {
expect(isBatteryPresent).assertTrue(); expect(isBatteryPresent).assertTrue();
}else{ } else {
expect(isBatteryPresent).assertFalse(); expect(isBatteryPresent).assertFalse();
} }
}) })
......
...@@ -19,7 +19,7 @@ import runningLock from '@ohos.runningLock'; ...@@ -19,7 +19,7 @@ import runningLock from '@ohos.runningLock';
import power from '@ohos.power'; import power from '@ohos.power';
import '@ohos.permission.RUNNING_LOCK' import '@ohos.permission.RUNNING_LOCK'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('appInfoTest', function () { describe('appInfoTest', function () {
console.log("*************Power Unit Test Begin*************"); console.log("*************Power Unit Test Begin*************");
...@@ -44,7 +44,7 @@ describe('appInfoTest', function () { ...@@ -44,7 +44,7 @@ describe('appInfoTest', function () {
if (typeof error === "undefined") { if (typeof error === "undefined") {
console.info('create_running_lock_callback_test: runningLock is ' + runninglock); console.info('create_running_lock_callback_test: runningLock is ' + runninglock);
expect(runninglock !== null).assertTrue(); expect(runninglock !== null).assertTrue();
var used = runninglock.isUsed(); let used = runninglock.isUsed();
console.info('create_running_lock_callback_test is used: ' + used); console.info('create_running_lock_callback_test is used: ' + used);
expect(used).assertFalse(); expect(used).assertFalse();
runninglock.lock(500); runninglock.lock(500);
...@@ -65,7 +65,7 @@ describe('appInfoTest', function () { ...@@ -65,7 +65,7 @@ describe('appInfoTest', function () {
runningLock.createRunningLock("running_lock_test_3", runningLock.RunningLockType.BACKGROUND) runningLock.createRunningLock("running_lock_test_3", runningLock.RunningLockType.BACKGROUND)
.then(runninglock => { .then(runninglock => {
expect(runninglock !== null).assertTrue(); expect(runninglock !== null).assertTrue();
var used = runninglock.isUsed(); let used = runninglock.isUsed();
console.info('running_lock_lock_test is used: ' + used); console.info('running_lock_lock_test is used: ' + used);
expect(used).assertFalse(); expect(used).assertFalse();
runninglock.lock(500); runninglock.lock(500);
...@@ -86,7 +86,7 @@ describe('appInfoTest', function () { ...@@ -86,7 +86,7 @@ describe('appInfoTest', function () {
runningLock.createRunningLock("running_lock_test_4", runningLock.RunningLockType.BACKGROUND) runningLock.createRunningLock("running_lock_test_4", runningLock.RunningLockType.BACKGROUND)
.then(runninglock => { .then(runninglock => {
expect(runninglock !== null).assertTrue(); expect(runninglock !== null).assertTrue();
var used = runninglock.isUsed(); let used = runninglock.isUsed();
console.info('running_lock_isused_test used: ' + used); console.info('running_lock_isused_test used: ' + used);
expect(used).assertFalse(); expect(used).assertFalse();
console.info('running_lock_isused_test success'); console.info('running_lock_isused_test success');
...@@ -103,7 +103,7 @@ describe('appInfoTest', function () { ...@@ -103,7 +103,7 @@ describe('appInfoTest', function () {
runningLock.createRunningLock("running_lock_test_5", runningLock.RunningLockType.BACKGROUND) runningLock.createRunningLock("running_lock_test_5", runningLock.RunningLockType.BACKGROUND)
.then(runninglock => { .then(runninglock => {
expect(runninglock !== null).assertTrue(); expect(runninglock !== null).assertTrue();
var used = runninglock.isUsed(); let used = runninglock.isUsed();
console.info('running_lock_unlock_test is used: ' + used); console.info('running_lock_unlock_test is used: ' + used);
expect(used).assertFalse(); expect(used).assertFalse();
runninglock.lock(500); runninglock.lock(500);
...@@ -125,14 +125,14 @@ describe('appInfoTest', function () { ...@@ -125,14 +125,14 @@ describe('appInfoTest', function () {
}) })
//Runninglock锁的类型为BACKGROUND //Runninglock锁的类型为BACKGROUND
it('enum_runningLock_type_background_test', 0, function () { it('enum_runningLock_type_background_test', 0, function () {
var runningLockType = runningLock.RunningLockType.BACKGROUND; let runningLockType = runningLock.RunningLockType.BACKGROUND;
console.info('runningLockType = ' + runningLockType); console.info('runningLockType = ' + runningLockType);
expect(runningLockType == 1).assertTrue(); expect(runningLockType == 1).assertTrue();
console.info('enum_runningLock_type_background_test success'); console.info('enum_runningLock_type_background_test success');
}) })
//Runninglock锁的类型为PROXIMITY_SCREEN_CONTROL //Runninglock锁的类型为PROXIMITY_SCREEN_CONTROL
it('enum_runningLock_type_proximityscreencontrol_test', 0, function () { it('enum_runningLock_type_proximityscreencontrol_test', 0, function () {
var runningLockType = runningLock.RunningLockType.PROXIMITY_SCREEN_CONTROL; let runningLockType = runningLock.RunningLockType.PROXIMITY_SCREEN_CONTROL;
console.info('runningLockType = ' + runningLockType); console.info('runningLockType = ' + runningLockType);
expect(runningLockType == 2).assertTrue(); expect(runningLockType == 2).assertTrue();
console.info('enum_runningLock_type_proximityscreencontrol_test success'); console.info('enum_runningLock_type_proximityscreencontrol_test success');
......
...@@ -15,18 +15,18 @@ ...@@ -15,18 +15,18 @@
import app from '@system.app' import app from '@system.app'
import batteryStats from "@ohos.batteryStatistics" import batteryStats from "@ohos.batteryStatistics"
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
var ConsumptionType = { let ConsumptionType = {
CONSUMPTION_TYPE_INVALID : -17, CONSUMPTION_TYPE_INVALID: -17,
CONSUMPTION_TYPE_APP : -16, CONSUMPTION_TYPE_APP: -16,
CONSUMPTION_TYPE_BLUETOOTH : -15, CONSUMPTION_TYPE_BLUETOOTH: -15,
CONSUMPTION_TYPE_IDLE : -14, CONSUMPTION_TYPE_IDLE: -14,
CONSUMPTION_TYPE_PHONE : -13, CONSUMPTION_TYPE_PHONE: -13,
CONSUMPTION_TYPE_RADIO : -12, CONSUMPTION_TYPE_RADIO: -12,
CONSUMPTION_TYPE_SCREEN : -11, CONSUMPTION_TYPE_SCREEN: -11,
CONSUMPTION_TYPE_USER : -10, CONSUMPTION_TYPE_USER: -10,
CONSUMPTION_TYPE_WIFI : -9, CONSUMPTION_TYPE_WIFI: -9,
} }
describe('appInfoTest', function () { describe('appInfoTest', function () {
...@@ -38,7 +38,7 @@ describe('appInfoTest', function () { ...@@ -38,7 +38,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_BLUETOOTH * @tc.desc batteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_BLUETOOTH
*/ */
it('batteryStats_001', 0, async function (done) { it('batteryStats_001', 0, async function (done) {
var infoList; let infoList;
let promise = batteryStats.getBatteryStats().then(function (value) { let promise = batteryStats.getBatteryStats().then(function (value) {
infoList = value; infoList = value;
console.info("Executing"); console.info("Executing");
...@@ -47,7 +47,7 @@ describe('appInfoTest', function () { ...@@ -47,7 +47,7 @@ describe('appInfoTest', function () {
}); });
await promise; await promise;
console.info("Waiting"); console.info("Waiting");
var found = false; let found = false;
for (let i = 0; i < infoList.length; i++) { for (let i = 0; i < infoList.length; i++) {
if (infoList[i].type == ConsumptionType.CONSUMPTION_TYPE_BLUETOOTH) { if (infoList[i].type == ConsumptionType.CONSUMPTION_TYPE_BLUETOOTH) {
expect(infoList[i].uid).assertEqual(-1); expect(infoList[i].uid).assertEqual(-1);
...@@ -65,7 +65,7 @@ describe('appInfoTest', function () { ...@@ -65,7 +65,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_IDLE * @tc.desc batteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_IDLE
*/ */
it('batteryStats_002', 0, async function (done) { it('batteryStats_002', 0, async function (done) {
var infoList; let infoList;
let promise = batteryStats.getBatteryStats().then(function (value) { let promise = batteryStats.getBatteryStats().then(function (value) {
infoList = value; infoList = value;
console.info("Executing"); console.info("Executing");
...@@ -74,7 +74,7 @@ describe('appInfoTest', function () { ...@@ -74,7 +74,7 @@ describe('appInfoTest', function () {
}); });
await promise; await promise;
console.info("Waiting"); console.info("Waiting");
var found = false; let found = false;
for (let i = 0; i < infoList.length; i++) { for (let i = 0; i < infoList.length; i++) {
if (infoList[i].type == ConsumptionType.CONSUMPTION_TYPE_IDLE) { if (infoList[i].type == ConsumptionType.CONSUMPTION_TYPE_IDLE) {
expect(infoList[i].uid).assertEqual(-1); expect(infoList[i].uid).assertEqual(-1);
...@@ -92,7 +92,7 @@ describe('appInfoTest', function () { ...@@ -92,7 +92,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_PHONE * @tc.desc batteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_PHONE
*/ */
it('batteryStats_003', 0, async function (done) { it('batteryStats_003', 0, async function (done) {
var infoList; let infoList;
let promise = batteryStats.getBatteryStats().then(function (value) { let promise = batteryStats.getBatteryStats().then(function (value) {
infoList = value; infoList = value;
console.info("Executing"); console.info("Executing");
...@@ -101,7 +101,7 @@ describe('appInfoTest', function () { ...@@ -101,7 +101,7 @@ describe('appInfoTest', function () {
}); });
await promise; await promise;
console.info("Waiting"); console.info("Waiting");
var found = false; let found = false;
for (let i = 0; i < infoList.length; i++) { for (let i = 0; i < infoList.length; i++) {
if (infoList[i].type == ConsumptionType.CONSUMPTION_TYPE_PHONE) { if (infoList[i].type == ConsumptionType.CONSUMPTION_TYPE_PHONE) {
expect(infoList[i].uid).assertEqual(-1); expect(infoList[i].uid).assertEqual(-1);
...@@ -119,7 +119,7 @@ describe('appInfoTest', function () { ...@@ -119,7 +119,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_RADIO * @tc.desc batteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_RADIO
*/ */
it('batteryStats_004', 0, async function (done) { it('batteryStats_004', 0, async function (done) {
var infoList; let infoList;
let promise = batteryStats.getBatteryStats().then(function (value) { let promise = batteryStats.getBatteryStats().then(function (value) {
infoList = value; infoList = value;
console.info("Executing"); console.info("Executing");
...@@ -128,7 +128,7 @@ describe('appInfoTest', function () { ...@@ -128,7 +128,7 @@ describe('appInfoTest', function () {
}); });
await promise; await promise;
console.info("Waiting"); console.info("Waiting");
var found = false; let found = false;
for (let i = 0; i < infoList.length; i++) { for (let i = 0; i < infoList.length; i++) {
if (infoList[i].type == ConsumptionType.CONSUMPTION_TYPE_RADIO) { if (infoList[i].type == ConsumptionType.CONSUMPTION_TYPE_RADIO) {
expect(infoList[i].uid).assertEqual(-1); expect(infoList[i].uid).assertEqual(-1);
...@@ -146,7 +146,7 @@ describe('appInfoTest', function () { ...@@ -146,7 +146,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_SCREEN * @tc.desc batteryStats getBatteryStats Interface Test type = ConsumptionType.CONSUMPTION_TYPE_SCREEN
*/ */
it('batteryStats_005', 0, async function (done) { it('batteryStats_005', 0, async function (done) {
var infoList; let infoList;
let promise = batteryStats.getBatteryStats().then(function (value) { let promise = batteryStats.getBatteryStats().then(function (value) {
infoList = value; infoList = value;
console.info("Executing"); console.info("Executing");
...@@ -155,7 +155,7 @@ describe('appInfoTest', function () { ...@@ -155,7 +155,7 @@ describe('appInfoTest', function () {
}); });
await promise; await promise;
console.info("Waiting"); console.info("Waiting");
var found = false; let found = false;
for (let i = 0; i < infoList.length; i++) { for (let i = 0; i < infoList.length; i++) {
if (infoList[i].type == ConsumptionType.CONSUMPTION_TYPE_SCREEN) { if (infoList[i].type == ConsumptionType.CONSUMPTION_TYPE_SCREEN) {
expect(infoList[i].uid).assertEqual(-1); expect(infoList[i].uid).assertEqual(-1);
...@@ -172,7 +172,7 @@ describe('appInfoTest', function () { ...@@ -172,7 +172,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getAppPowerValue Interface Test uid = 111 * @tc.desc batteryStats getAppPowerValue Interface Test uid = 111
*/ */
it('batteryStats_006', 0, function () { it('batteryStats_006', 0, function () {
var power = batteryStats.getAppPowerValue(111); let power = batteryStats.getAppPowerValue(111);
console.info("App consumption power of uid 111 is: " + power); console.info("App consumption power of uid 111 is: " + power);
expect(power >= 0).assertTrue(); expect(power >= 0).assertTrue();
}) })
...@@ -182,7 +182,7 @@ describe('appInfoTest', function () { ...@@ -182,7 +182,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getAppPowerValue Interface Test uid = -111 * @tc.desc batteryStats getAppPowerValue Interface Test uid = -111
*/ */
it('batteryStats_007', 0, function () { it('batteryStats_007', 0, function () {
var power = batteryStats.getAppPowerValue(-111); let power = batteryStats.getAppPowerValue(-111);
console.info("App consumption power of uid -111 is: " + power); console.info("App consumption power of uid -111 is: " + power);
expect(power).assertEqual(0); expect(power).assertEqual(0);
}) })
...@@ -192,7 +192,7 @@ describe('appInfoTest', function () { ...@@ -192,7 +192,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getAppPowerValue Interface Test uid = 0 * @tc.desc batteryStats getAppPowerValue Interface Test uid = 0
*/ */
it('batteryStats_008', 0, function () { it('batteryStats_008', 0, function () {
var power = batteryStats.getAppPowerValue(0); let power = batteryStats.getAppPowerValue(0);
console.info("App consumption power of uid 0 is: " + power); console.info("App consumption power of uid 0 is: " + power);
expect(power >= 0).assertTrue(); expect(power >= 0).assertTrue();
}) })
...@@ -202,10 +202,10 @@ describe('appInfoTest', function () { ...@@ -202,10 +202,10 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getAppPowerValue Interface Test uid = "111" * @tc.desc batteryStats getAppPowerValue Interface Test uid = "111"
*/ */
it('batteryStats_009', 0, function () { it('batteryStats_009', 0, function () {
try{ try {
batteryStats.getAppPowerValue("111"); batteryStats.getAppPowerValue("111");
} catch(e) { } catch (e) {
var errorMsg = "Argument type check works: " + e; let errorMsg = "Argument type check works: " + e;
console.debug("errorMsg"); console.debug("errorMsg");
expect(errorMsg.includes("Wrong argument type")).assertTrue(); expect(errorMsg.includes("Wrong argument type")).assertTrue();
} }
...@@ -216,10 +216,10 @@ describe('appInfoTest', function () { ...@@ -216,10 +216,10 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getAppPowerValue Interface Test uid = 111, 222 * @tc.desc batteryStats getAppPowerValue Interface Test uid = 111, 222
*/ */
it('batteryStats_010', 0, function () { it('batteryStats_010', 0, function () {
try{ try {
batteryStats.getAppPowerValue(111, 222); batteryStats.getAppPowerValue(111, 222);
} catch(e) { } catch (e) {
var errorMsg = "Argument number check works: " + e; let errorMsg = "Argument number check works: " + e;
console.debug(errorMsg); console.debug(errorMsg);
expect(errorMsg.includes("Wrong number of arguments")).assertTrue(); expect(errorMsg.includes("Wrong number of arguments")).assertTrue();
} }
...@@ -230,7 +230,7 @@ describe('appInfoTest', function () { ...@@ -230,7 +230,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getAppPowerPercent Interface Test uid = 111 * @tc.desc batteryStats getAppPowerPercent Interface Test uid = 111
*/ */
it('batteryStats_011', 0, function () { it('batteryStats_011', 0, function () {
var powerPercent = batteryStats.getAppPowerPercent(111); let powerPercent = batteryStats.getAppPowerPercent(111);
console.info("App consumption percent of uid 111 is: " + powerPercent); console.info("App consumption percent of uid 111 is: " + powerPercent);
expect(powerPercent >= 0).assertTrue(); expect(powerPercent >= 0).assertTrue();
}) })
...@@ -240,7 +240,7 @@ describe('appInfoTest', function () { ...@@ -240,7 +240,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getAppPowerPercent Interface Test uid = -111 * @tc.desc batteryStats getAppPowerPercent Interface Test uid = -111
*/ */
it('batteryStats_012', 0, function () { it('batteryStats_012', 0, function () {
var powerPercent = batteryStats.getAppPowerPercent(-111); let powerPercent = batteryStats.getAppPowerPercent(-111);
console.info("App consumption percent of uid -111 is: " + powerPercent); console.info("App consumption percent of uid -111 is: " + powerPercent);
expect(powerPercent).assertEqual(0); expect(powerPercent).assertEqual(0);
}) })
...@@ -250,7 +250,7 @@ describe('appInfoTest', function () { ...@@ -250,7 +250,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getAppPowerPercent Interface Test uid = 0 * @tc.desc batteryStats getAppPowerPercent Interface Test uid = 0
*/ */
it('batteryStats_013', 0, function () { it('batteryStats_013', 0, function () {
var powerPercent = batteryStats.getAppPowerPercent(0); let powerPercent = batteryStats.getAppPowerPercent(0);
console.info("App consumption percent of uid 0 is: " + powerPercent); console.info("App consumption percent of uid 0 is: " + powerPercent);
expect(powerPercent >= 0).assertTrue(); expect(powerPercent >= 0).assertTrue();
}) })
...@@ -260,10 +260,10 @@ describe('appInfoTest', function () { ...@@ -260,10 +260,10 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getAppPowerPercent Interface Test uid = "111" * @tc.desc batteryStats getAppPowerPercent Interface Test uid = "111"
*/ */
it('batteryStats_014', 0, function () { it('batteryStats_014', 0, function () {
try{ try {
batteryStats.getAppPowerPercent("111"); batteryStats.getAppPowerPercent("111");
} catch(e) { } catch (e) {
var errorMsg = "Argument type check works: " + e; let errorMsg = "Argument type check works: " + e;
console.debug("errorMsg"); console.debug("errorMsg");
expect(errorMsg.includes("Wrong argument type")).assertTrue(); expect(errorMsg.includes("Wrong argument type")).assertTrue();
} }
...@@ -274,10 +274,10 @@ describe('appInfoTest', function () { ...@@ -274,10 +274,10 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getAppPowerPercent Interface Test uid = 111, 222 * @tc.desc batteryStats getAppPowerPercent Interface Test uid = 111, 222
*/ */
it('batteryStats_015', 0, function () { it('batteryStats_015', 0, function () {
try{ try {
batteryStats.getAppPowerPercent(111, 222); batteryStats.getAppPowerPercent(111, 222);
} catch(e) { } catch (e) {
var errorMsg = "Argument number check works: " + e; let errorMsg = "Argument number check works: " + e;
console.debug(errorMsg); console.debug(errorMsg);
expect(errorMsg.includes("Wrong number of arguments")).assertTrue(); expect(errorMsg.includes("Wrong number of arguments")).assertTrue();
} }
...@@ -288,7 +288,7 @@ describe('appInfoTest', function () { ...@@ -288,7 +288,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getHardwareUnitPowerValue Interface Test type = ConsumptionType.CONSUMPTION_TYPE_IDLE * @tc.desc batteryStats getHardwareUnitPowerValue Interface Test type = ConsumptionType.CONSUMPTION_TYPE_IDLE
*/ */
it('batteryStats_016', 0, function () { it('batteryStats_016', 0, function () {
var power = batteryStats.getHardwareUnitPowerValue(ConsumptionType.CONSUMPTION_TYPE_IDLE); let power = batteryStats.getHardwareUnitPowerValue(ConsumptionType.CONSUMPTION_TYPE_IDLE);
console.info("Idle consumption power is: " + power); console.info("Idle consumption power is: " + power);
expect(power >= 0).assertTrue(); expect(power >= 0).assertTrue();
}) })
...@@ -298,7 +298,7 @@ describe('appInfoTest', function () { ...@@ -298,7 +298,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getHardwareUnitPowerValue Interface Test type = 111 * @tc.desc batteryStats getHardwareUnitPowerValue Interface Test type = 111
*/ */
it('batteryStats_017', 0, function () { it('batteryStats_017', 0, function () {
var power = batteryStats.getHardwareUnitPowerValue(111); let power = batteryStats.getHardwareUnitPowerValue(111);
console.info("111's consumption power is: " + power); console.info("111's consumption power is: " + power);
expect(power).assertEqual(0); expect(power).assertEqual(0);
}) })
...@@ -308,7 +308,7 @@ describe('appInfoTest', function () { ...@@ -308,7 +308,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getHardwareUnitPowerValue Interface Test type = 0 * @tc.desc batteryStats getHardwareUnitPowerValue Interface Test type = 0
*/ */
it('batteryStats_018', 0, function () { it('batteryStats_018', 0, function () {
var power = batteryStats.getHardwareUnitPowerValue(0); let power = batteryStats.getHardwareUnitPowerValue(0);
console.info("0's consumption power is: " + power); console.info("0's consumption power is: " + power);
expect(power).assertEqual(0); expect(power).assertEqual(0);
}) })
...@@ -318,10 +318,10 @@ describe('appInfoTest', function () { ...@@ -318,10 +318,10 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getHardwareUnitPowerValue Interface Test type = "test" * @tc.desc batteryStats getHardwareUnitPowerValue Interface Test type = "test"
*/ */
it('batteryStats_019', 0, function () { it('batteryStats_019', 0, function () {
try{ try {
batteryStats.getHardwareUnitPowerValue("test"); batteryStats.getHardwareUnitPowerValue("test");
} catch(e) { } catch (e) {
var errorMsg = "Argument type check works: " + e; let errorMsg = "Argument type check works: " + e;
console.debug("errorMsg"); console.debug("errorMsg");
expect(errorMsg.includes("Wrong argument type")).assertTrue(); expect(errorMsg.includes("Wrong argument type")).assertTrue();
} }
...@@ -333,11 +333,11 @@ describe('appInfoTest', function () { ...@@ -333,11 +333,11 @@ describe('appInfoTest', function () {
* and ConsumptionType.CONSUMPTION_TYPE_WIFI * and ConsumptionType.CONSUMPTION_TYPE_WIFI
*/ */
it('batteryStats_020', 0, function () { it('batteryStats_020', 0, function () {
try{ try {
batteryStats.getHardwareUnitPowerValue(ConsumptionType.CONSUMPTION_TYPE_IDLE, batteryStats.getHardwareUnitPowerValue(ConsumptionType.CONSUMPTION_TYPE_IDLE,
ConsumptionType.CONSUMPTION_TYPE_WIFI); ConsumptionType.CONSUMPTION_TYPE_WIFI);
} catch(e) { } catch (e) {
var errorMsg = "Argument number check works: " + e; let errorMsg = "Argument number check works: " + e;
console.debug(errorMsg); console.debug(errorMsg);
expect(errorMsg.includes("Wrong number of arguments")).assertTrue(); expect(errorMsg.includes("Wrong number of arguments")).assertTrue();
} }
...@@ -348,7 +348,7 @@ describe('appInfoTest', function () { ...@@ -348,7 +348,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getHardwareUnitPowerPercent Interface Test type = ConsumptionType.CONSUMPTION_TYPE_IDLE * @tc.desc batteryStats getHardwareUnitPowerPercent Interface Test type = ConsumptionType.CONSUMPTION_TYPE_IDLE
*/ */
it('batteryStats_021', 0, function () { it('batteryStats_021', 0, function () {
var powerPercent = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_IDLE); let powerPercent = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_IDLE);
console.info("Idle consumption percent is: " + powerPercent); console.info("Idle consumption percent is: " + powerPercent);
expect(powerPercent >= 0).assertTrue(); expect(powerPercent >= 0).assertTrue();
}) })
...@@ -358,7 +358,7 @@ describe('appInfoTest', function () { ...@@ -358,7 +358,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getHardwareUnitPowerPercent Interface Test type = 111 * @tc.desc batteryStats getHardwareUnitPowerPercent Interface Test type = 111
*/ */
it('batteryStats_022', 0, function () { it('batteryStats_022', 0, function () {
var powerPercent = batteryStats.getHardwareUnitPowerPercent(111); let powerPercent = batteryStats.getHardwareUnitPowerPercent(111);
console.info("111's consumption percent is: " + powerPercent); console.info("111's consumption percent is: " + powerPercent);
expect(powerPercent).assertEqual(0); expect(powerPercent).assertEqual(0);
}) })
...@@ -368,7 +368,7 @@ describe('appInfoTest', function () { ...@@ -368,7 +368,7 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getHardwareUnitPowerPercent Interface Test type = 0 * @tc.desc batteryStats getHardwareUnitPowerPercent Interface Test type = 0
*/ */
it('batteryStats_023', 0, function () { it('batteryStats_023', 0, function () {
var powerPercent = batteryStats.getHardwareUnitPowerPercent(0); let powerPercent = batteryStats.getHardwareUnitPowerPercent(0);
console.info("0's consumption percent is: " + powerPercent); console.info("0's consumption percent is: " + powerPercent);
expect(powerPercent).assertEqual(0); expect(powerPercent).assertEqual(0);
}) })
...@@ -378,10 +378,10 @@ describe('appInfoTest', function () { ...@@ -378,10 +378,10 @@ describe('appInfoTest', function () {
* @tc.desc batteryStats getHardwareUnitPowerPercent Interface Test type = "test" * @tc.desc batteryStats getHardwareUnitPowerPercent Interface Test type = "test"
*/ */
it('batteryStats_024', 0, function () { it('batteryStats_024', 0, function () {
try{ try {
batteryStats.getHardwareUnitPowerPercent("test"); batteryStats.getHardwareUnitPowerPercent("test");
} catch(e) { } catch (e) {
var errorMsg = "Argument type check works: " + e; let errorMsg = "Argument type check works: " + e;
console.debug("errorMsg"); console.debug("errorMsg");
expect(errorMsg.includes("Wrong argument type")).assertTrue(); expect(errorMsg.includes("Wrong argument type")).assertTrue();
} }
...@@ -393,11 +393,11 @@ describe('appInfoTest', function () { ...@@ -393,11 +393,11 @@ describe('appInfoTest', function () {
* and ConsumptionType.CONSUMPTION_TYPE_WIFI * and ConsumptionType.CONSUMPTION_TYPE_WIFI
*/ */
it('batteryStats_025', 0, function () { it('batteryStats_025', 0, function () {
try{ try {
batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_IDLE, batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_IDLE,
ConsumptionType.CONSUMPTION_TYPE_WIFI); ConsumptionType.CONSUMPTION_TYPE_WIFI);
} catch(e) { } catch (e) {
var errorMsg = "Argument number check works: " + e; let errorMsg = "Argument number check works: " + e;
console.debug(errorMsg); console.debug(errorMsg);
expect(errorMsg.includes("Wrong number of arguments")).assertTrue(); expect(errorMsg.includes("Wrong number of arguments")).assertTrue();
} }
......
...@@ -31,13 +31,13 @@ describe('appInfoTest', function () { ...@@ -31,13 +31,13 @@ describe('appInfoTest', function () {
}) })
function createSubscriber() { function createSubscriber() {
var commonEventSubscribeInfo = { let commonEventSubscribeInfo = {
events: [commonEvent.Support.COMMON_EVENT_THERMAL_LEVEL_CHANGED], events: [commonEvent.Support.COMMON_EVENT_THERMAL_LEVEL_CHANGED],
}; };
commonEvent.createSubscriber(commonEventSubscribeInfo) commonEvent.createSubscriber(commonEventSubscribeInfo)
.then(subscriber => { .then(subscriber => {
console.info('createSubscriber success'); console.info('createSubscriber success');
var mySubscriber = subscriber; let mySubscriber = subscriber;
console.log(subscriber); console.log(subscriber);
if (subscriber == "" || subscriber == undefined || subscriber == null) { if (subscriber == "" || subscriber == undefined || subscriber == null) {
...@@ -64,7 +64,7 @@ function createSubscriber() { ...@@ -64,7 +64,7 @@ function createSubscriber() {
console.info("commonEventData bundleName: " + commonEventData.bundleName); console.info("commonEventData bundleName: " + commonEventData.bundleName);
console.info("commonEventData data: " + commonEventData.data); console.info("commonEventData data: " + commonEventData.data);
console.info("commonEventData parameter: " + commonEventData.parameters[0]); console.info("commonEventData parameter: " + commonEventData.parameters[0]);
var level = -1; let level = -1;
expect(level >= thermal.ThermalLevel.COOL && warm <= level.ThermalLevel.EMERGENCY).assertTrue(); expect(level >= thermal.ThermalLevel.COOL && warm <= level.ThermalLevel.EMERGENCY).assertTrue();
}); });
}).catch((error) => { }).catch((error) => {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
*/ */
import thermal from "@ohos.thermal" import thermal from "@ohos.thermal"
import {describe, it, expect} from 'deccjsunit/index'; import { describe, it, expect } from 'deccjsunit/index';
describe('appInfoTest', function () { describe('appInfoTest', function () {
console.log("*************Thermal Performance Test Begin*************"); console.log("*************Thermal Performance Test Begin*************");
...@@ -25,7 +25,7 @@ describe('appInfoTest', function () { ...@@ -25,7 +25,7 @@ describe('appInfoTest', function () {
}) })
function performanceTest1() { function performanceTest1() {
var MAXNUM = 1000; let MAXNUM = 1000;
/** /**
* @tc.number ThermalPerformance_001 * @tc.number ThermalPerformance_001
...@@ -35,7 +35,7 @@ function performanceTest1() { ...@@ -35,7 +35,7 @@ function performanceTest1() {
it('ThermalPerformance_001', 0, function () { it('ThermalPerformance_001', 0, function () {
let startTime = new Date().getTime(); let startTime = new Date().getTime();
for (let i = 0; i < MAXNUM; i++) { for (let i = 0; i < MAXNUM; i++) {
var level = thermal.getThermalLevel(); let level = thermal.getThermalLevel();
} }
let waitTime = new Date().getTime() - startTime; let waitTime = new Date().getTime() - startTime;
let avgTime = waitTime; //us let avgTime = waitTime; //us
...@@ -44,7 +44,7 @@ function performanceTest1() { ...@@ -44,7 +44,7 @@ function performanceTest1() {
} }
function performanceTest2() { function performanceTest2() {
var MAXNUM = 1000; let MAXNUM = 1000;
/** /**
* @tc.number ThermalPerformance_002 * @tc.number ThermalPerformance_002
...@@ -65,7 +65,7 @@ function performanceTest2() { ...@@ -65,7 +65,7 @@ function performanceTest2() {
} }
function performanceTest3() { function performanceTest3() {
var MAXNUM = 1000; let MAXNUM = 1000;
/** /**
* @tc.number ThermalPerformance_002 * @tc.number ThermalPerformance_002
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
import app from '@system.app' import app from '@system.app'
import thermal from "@ohos.thermal" import thermal from "@ohos.thermal"
import ThermalLevel from "@ohos.thermal" import ThermalLevel from "@ohos.thermal"
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
describe('appInfoTest', function () { describe('appInfoTest', function () {
console.log("*************Thermal API Test Begin*************"); console.log("*************Thermal API Test Begin*************");
...@@ -46,9 +46,9 @@ function test1() { ...@@ -46,9 +46,9 @@ function test1() {
*/ */
it('Thermal_001', 0, async function (done) { it('Thermal_001', 0, async function (done) {
console.info("enter"); console.info("enter");
await new Promise((resolve, reject) =>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
var cold = thermal.getThermalLevel(); let cold = thermal.getThermalLevel();
console.info("cold level is: " + cold); console.info("cold level is: " + cold);
expect(cold >= thermal.ThermalLevel.COOL && cold <= thermal.ThermalLevel.EMERGENCY).assertTrue(); expect(cold >= thermal.ThermalLevel.COOL && cold <= thermal.ThermalLevel.EMERGENCY).assertTrue();
resolve(); resolve();
...@@ -66,9 +66,9 @@ function test2() { ...@@ -66,9 +66,9 @@ function test2() {
* @tc.desc Thermal acquisition kit * @tc.desc Thermal acquisition kit
*/ */
it('Thermal_002', 0, async function (done) { it('Thermal_002', 0, async function (done) {
await new Promise((resolve, reject) =>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
var warm = thermal.getThermalLevel(); let warm = thermal.getThermalLevel();
console.info("warm level is: " + warm); console.info("warm level is: " + warm);
expect(warm >= thermal.ThermalLevel.COOL && warm <= thermal.ThermalLevel.EMERGENCY).assertTrue(); expect(warm >= thermal.ThermalLevel.COOL && warm <= thermal.ThermalLevel.EMERGENCY).assertTrue();
resolve(); resolve();
...@@ -86,9 +86,9 @@ function test3() { ...@@ -86,9 +86,9 @@ function test3() {
* @tc.desc Thermal acquisition kit * @tc.desc Thermal acquisition kit
*/ */
it('Thermal_003', 0, async function (done) { it('Thermal_003', 0, async function (done) {
await new Promise((resolve, reject)=>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
var hot = thermal.getThermalLevel(); let hot = thermal.getThermalLevel();
console.info("hot level is: " + hot); console.info("hot level is: " + hot);
expect(hot >= thermal.ThermalLevel.COOL && hot <= thermal.ThermalLevel.EMERGENCY).assertTrue(); expect(hot >= thermal.ThermalLevel.COOL && hot <= thermal.ThermalLevel.EMERGENCY).assertTrue();
resolve(); resolve();
...@@ -106,9 +106,9 @@ function test4() { ...@@ -106,9 +106,9 @@ function test4() {
* @tc.desc Thermal acquisition kit * @tc.desc Thermal acquisition kit
*/ */
it('Thermal_004', 0, async function (done) { it('Thermal_004', 0, async function (done) {
await new Promise((resolve, reject)=>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
var overheated = thermal.getThermalLevel(); let overheated = thermal.getThermalLevel();
console.info("overheated level is: " + overheated); console.info("overheated level is: " + overheated);
expect(overheated >= thermal.ThermalLevel.COOL && expect(overheated >= thermal.ThermalLevel.COOL &&
overheated <= thermal.ThermalLevel.EMERGENCY).assertTrue(); overheated <= thermal.ThermalLevel.EMERGENCY).assertTrue();
...@@ -127,9 +127,9 @@ function test5() { ...@@ -127,9 +127,9 @@ function test5() {
* @tc.desc Thermal acquisition kit * @tc.desc Thermal acquisition kit
*/ */
it('Thermal_005', 0, async function (done) { it('Thermal_005', 0, async function (done) {
await new Promise((resolve, reject)=>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
var warning = thermal.getThermalLevel(); let warning = thermal.getThermalLevel();
console.info("warning level is: " + warning); console.info("warning level is: " + warning);
expect(warning >= thermal.ThermalLevel.COOL && warning <= thermal.ThermalLevel.EMERGENCY).assertTrue(); expect(warning >= thermal.ThermalLevel.COOL && warning <= thermal.ThermalLevel.EMERGENCY).assertTrue();
resolve(); resolve();
...@@ -147,9 +147,9 @@ function test6() { ...@@ -147,9 +147,9 @@ function test6() {
* @tc.desc Thermal acquisition kit * @tc.desc Thermal acquisition kit
*/ */
it('Thermal_006', 0, async function (done) { it('Thermal_006', 0, async function (done) {
await new Promise((resolve, reject)=>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
var emergency = thermal.getThermalLevel(); let emergency = thermal.getThermalLevel();
console.info("emergency level is: " + emergency); console.info("emergency level is: " + emergency);
expect(emergency >= thermal.ThermalLevel.COOL && expect(emergency >= thermal.ThermalLevel.COOL &&
emergency <= thermal.ThermalLevel.EMERGENCY).assertTrue(); emergency <= thermal.ThermalLevel.EMERGENCY).assertTrue();
...@@ -173,8 +173,8 @@ function test7() { ...@@ -173,8 +173,8 @@ function test7() {
expect(cool >= thermal.ThermalLevel.COOL && cool <= thermal.ThermalLevel.EMERGENCY).assertTrue(); expect(cool >= thermal.ThermalLevel.COOL && cool <= thermal.ThermalLevel.EMERGENCY).assertTrue();
done(); done();
}) })
await new Promise((resolve, reject)=>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
thermal.unsubscribeThermalLevel(() => { thermal.unsubscribeThermalLevel(() => {
console.info("unsubscribe successfully!"); console.info("unsubscribe successfully!");
}); });
...@@ -197,8 +197,8 @@ function test8() { ...@@ -197,8 +197,8 @@ function test8() {
expect(warm >= thermal.ThermalLevel.COOL && warm <= thermal.ThermalLevel.EMERGENCY).assertTrue(); expect(warm >= thermal.ThermalLevel.COOL && warm <= thermal.ThermalLevel.EMERGENCY).assertTrue();
done(); done();
}) })
await new Promise((resolve, reject)=>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
thermal.unsubscribeThermalLevel(() => { thermal.unsubscribeThermalLevel(() => {
console.info("unsubscribe successfully!"); console.info("unsubscribe successfully!");
}); });
...@@ -221,8 +221,8 @@ function test9() { ...@@ -221,8 +221,8 @@ function test9() {
expect(hot >= thermal.ThermalLevel.COOL && hot <= thermal.ThermalLevel.EMERGENCY).assertTrue(); expect(hot >= thermal.ThermalLevel.COOL && hot <= thermal.ThermalLevel.EMERGENCY).assertTrue();
done(); done();
}) })
await new Promise((resolve, reject)=>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
thermal.unsubscribeThermalLevel(() => { thermal.unsubscribeThermalLevel(() => {
console.info("unsubscribe successfully!"); console.info("unsubscribe successfully!");
}); });
...@@ -247,8 +247,8 @@ function test10() { ...@@ -247,8 +247,8 @@ function test10() {
overheated <= thermal.ThermalLevel.EMERGENCY).assertTrue(); overheated <= thermal.ThermalLevel.EMERGENCY).assertTrue();
done(); done();
}) })
await new Promise((resolve, reject)=>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
thermal.unsubscribeThermalLevel(() => { thermal.unsubscribeThermalLevel(() => {
console.info("unsubscribe successfully!"); console.info("unsubscribe successfully!");
}); });
...@@ -271,8 +271,8 @@ function test11() { ...@@ -271,8 +271,8 @@ function test11() {
expect(warning >= thermal.ThermalLevel.COOL && warning <= thermal.ThermalLevel.EMERGENCY).assertTrue(); expect(warning >= thermal.ThermalLevel.COOL && warning <= thermal.ThermalLevel.EMERGENCY).assertTrue();
done(); done();
}) })
await new Promise((resolve, reject)=>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
thermal.unsubscribeThermalLevel(() => { thermal.unsubscribeThermalLevel(() => {
console.info("unsubscribe successfully!"); console.info("unsubscribe successfully!");
}); });
...@@ -295,8 +295,8 @@ function test12() { ...@@ -295,8 +295,8 @@ function test12() {
expect(emergency >= thermal.ThermalLevel.COOL && emergency <= thermal.ThermalLevel.EMERGENCY).assertTrue(); expect(emergency >= thermal.ThermalLevel.COOL && emergency <= thermal.ThermalLevel.EMERGENCY).assertTrue();
done(); done();
}) })
await new Promise((resolve, reject)=>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
thermal.unsubscribeThermalLevel(() => { thermal.unsubscribeThermalLevel(() => {
console.info("unsubscribe successfully!"); console.info("unsubscribe successfully!");
}); });
...@@ -319,8 +319,8 @@ function test13() { ...@@ -319,8 +319,8 @@ function test13() {
expect(cool >= thermal.ThermalLevel.COOL && cool <= thermal.ThermalLevel.EMERGENCY).assertTrue(); expect(cool >= thermal.ThermalLevel.COOL && cool <= thermal.ThermalLevel.EMERGENCY).assertTrue();
done(); done();
}) })
await new Promise((resolve, reject)=>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
thermal.unsubscribeThermalLevel(() => { thermal.unsubscribeThermalLevel(() => {
console.info("unsubscribe successfully!"); console.info("unsubscribe successfully!");
}); });
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
import app from '@system.app' import app from '@system.app'
import thermal from "@ohos.thermal" import thermal from "@ohos.thermal"
import ThermalLevel from "@ohos.thermal" import ThermalLevel from "@ohos.thermal"
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
const MSEC_1000 = 1000; const MSEC_1000 = 1000;
describe('appInfoTest', function () { describe('appInfoTest', function () {
...@@ -33,9 +33,9 @@ function test14() { ...@@ -33,9 +33,9 @@ function test14() {
*/ */
it('Thermal_014', 0, async function (done) { it('Thermal_014', 0, async function (done) {
console.info("enter"); console.info("enter");
await new Promise((resolve, reject) =>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
var level = thermal.getThermalLevel(); let level = thermal.getThermalLevel();
console.info("level is: " + level); console.info("level is: " + level);
expect(level == -1).assertTrue(); expect(level == -1).assertTrue();
resolve(); resolve();
...@@ -57,8 +57,8 @@ function test15() { ...@@ -57,8 +57,8 @@ function test15() {
expect(level == -1).assertTrue(); expect(level == -1).assertTrue();
done(); done();
}) })
await new Promise((resolve, reject)=>{ await new Promise((resolve, reject) => {
setTimeout(()=>{ setTimeout(() => {
thermal.unsubscribeThermalLevel(() => { thermal.unsubscribeThermalLevel(() => {
console.info("unsubscribe successfully!"); console.info("unsubscribe successfully!");
}); });
......
...@@ -49,7 +49,7 @@ describe("SensorJsTest", function () { ...@@ -49,7 +49,7 @@ describe("SensorJsTest", function () {
console.info('afterEach caled') console.info('afterEach caled')
}) })
var SENSOR_DATA_MATRIX = [ let SENSOR_DATA_MATRIX = [
{ {
"rotation": [-0.7980074882507324, 0.5486301183700562, 0.24937734007835388, -0.17277367413043976, "rotation": [-0.7980074882507324, 0.5486301183700562, 0.24937734007835388, -0.17277367413043976,
-0.6047078967094421, 0.7774815559387207, 0.5773502588272095, 0.5773502588272095, 0.5773502588272095], -0.6047078967094421, 0.7774815559387207, 0.5773502588272095, 0.5773502588272095, 0.5773502588272095],
...@@ -172,7 +172,7 @@ describe("SensorJsTest", function () { ...@@ -172,7 +172,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_070 failed'); console.info('SensorJsTest_070 failed');
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
for (var i = 1; i < data.length; i++) { for (let i = 1; i < data.length; i++) {
console.info("SensorJsTest_070" + data[i]) console.info("SensorJsTest_070" + data[i])
expect(data[i]).assertEqual(GET_DIRECTION[0][i]) expect(data[i]).assertEqual(GET_DIRECTION[0][i])
} }
...@@ -195,7 +195,7 @@ describe("SensorJsTest", function () { ...@@ -195,7 +195,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_071 failed'); console.info('SensorJsTest_071 failed');
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
for (var i = 1; i < data.length; i++) { for (let i = 1; i < data.length; i++) {
console.info("SensorJsTest_071" + data[i]) console.info("SensorJsTest_071" + data[i])
expect(data[i]).assertEqual(GET_DIRECTION[1][i]) expect(data[i]).assertEqual(GET_DIRECTION[1][i])
} }
...@@ -271,7 +271,7 @@ describe("SensorJsTest", function () { ...@@ -271,7 +271,7 @@ describe("SensorJsTest", function () {
*/ */
it('SensorJsTest_075', 0, async function (done) { it('SensorJsTest_075', 0, async function (done) {
sensor.getDirection(rotationMatrix[0]).then((data) => { sensor.getDirection(rotationMatrix[0]).then((data) => {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsTest_075" + data[i]) console.info("SensorJsTest_075" + data[i])
expect(data[i]).assertEqual(GET_DIRECTION[0][i]) expect(data[i]).assertEqual(GET_DIRECTION[0][i])
} }
...@@ -292,7 +292,7 @@ describe("SensorJsTest", function () { ...@@ -292,7 +292,7 @@ describe("SensorJsTest", function () {
*/ */
it('SensorJsTest_076', 0, async function (done) { it('SensorJsTest_076', 0, async function (done) {
sensor.getDirection(rotationMatrix[1]).then((data) => { sensor.getDirection(rotationMatrix[1]).then((data) => {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsTest_076" + data[i]) console.info("SensorJsTest_076" + data[i])
expect(data[i]).assertEqual(GET_DIRECTION[1][i]) expect(data[i]).assertEqual(GET_DIRECTION[1][i])
} }
...@@ -313,7 +313,7 @@ describe("SensorJsTest", function () { ...@@ -313,7 +313,7 @@ describe("SensorJsTest", function () {
*/ */
it('SensorJsTest_077', 0, async function (done) { it('SensorJsTest_077', 0, async function (done) {
sensor.getDirection([1, 2, 3, 1, 2, 3, 1, 2, 3, 0]).then((data) => { sensor.getDirection([1, 2, 3, 1, 2, 3, 1, 2, 3, 0]).then((data) => {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsTest_077 failed") console.info("SensorJsTest_077 failed")
expect(false).assertTrue(); expect(false).assertTrue();
} }
...@@ -347,7 +347,7 @@ describe("SensorJsTest", function () { ...@@ -347,7 +347,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_078 failed'); console.info('SensorJsTest_078 failed');
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsAPI--->SensorJsTest_078 [" + i + "] = " + data[i]); console.info("SensorJsAPI--->SensorJsTest_078 [" + i + "] = " + data[i]);
expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[0][0]) && expect( expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[0][0]) && expect(
Number.isNaN(data[1])).assertTrue() && Number.isNaN(data[1])).assertTrue() &&
...@@ -377,7 +377,7 @@ describe("SensorJsTest", function () { ...@@ -377,7 +377,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_079 failed'); console.info('SensorJsTest_079 failed');
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsAPI--->SensorJsTest_079 [" + i + "] = " + data[i]); console.info("SensorJsAPI--->SensorJsTest_079 [" + i + "] = " + data[i]);
expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[1][0]) && expect( expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[1][0]) && expect(
Number.isNaN(data[1])).assertTrue() && Number.isNaN(data[1])).assertTrue() &&
...@@ -407,7 +407,7 @@ describe("SensorJsTest", function () { ...@@ -407,7 +407,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_080 failed'); console.info('SensorJsTest_080 failed');
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsAPI--->SensorJsTest_080 [" + i + "] = " + data[i]); console.info("SensorJsAPI--->SensorJsTest_080 [" + i + "] = " + data[i]);
expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[2][0]) expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[2][0])
&& expect(data[1]).assertEqual(ANGLECHANGE_9_RESULT[2][1]) && expect(data[1]).assertEqual(ANGLECHANGE_9_RESULT[2][1])
...@@ -437,7 +437,7 @@ describe("SensorJsTest", function () { ...@@ -437,7 +437,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_081 failed'); console.info('SensorJsTest_081 failed');
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsAPI--->SensorJsTest_081 [" + i + "] = " + data[i]); console.info("SensorJsAPI--->SensorJsTest_081 [" + i + "] = " + data[i]);
expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[3][0]) && expect( expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[3][0]) && expect(
Number.isNaN(data[1])).assertTrue() && expect(data[2]).assertEqual( Number.isNaN(data[1])).assertTrue() && expect(data[2]).assertEqual(
...@@ -466,7 +466,7 @@ describe("SensorJsTest", function () { ...@@ -466,7 +466,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_082 failed'); console.info('SensorJsTest_082 failed');
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsAPI--->SensorJsTest_082 [" + i + "] = " + data[i]); console.info("SensorJsAPI--->SensorJsTest_082 [" + i + "] = " + data[i]);
expect(Number.isNaN(data[0]) && Number.isNaN(data[1]) && Number.isNaN(data[2])).assertTrue(); expect(Number.isNaN(data[0]) && Number.isNaN(data[1]) && Number.isNaN(data[2])).assertTrue();
} }
...@@ -487,7 +487,7 @@ describe("SensorJsTest", function () { ...@@ -487,7 +487,7 @@ describe("SensorJsTest", function () {
console.info("SensorJsAPI--->SensorJsTest_083"); console.info("SensorJsAPI--->SensorJsTest_083");
sensor.getAngleModify([1, 2, 3, 1, 2, 3, 1, 2, 3], [2, 2, 2, 2, 2, 2, 2, 2, 2]).then((data) => { sensor.getAngleModify([1, 2, 3, 1, 2, 3, 1, 2, 3], [2, 2, 2, 2, 2, 2, 2, 2, 2]).then((data) => {
console.info("SensorJsAPI--->SensorJsTest_083"); console.info("SensorJsAPI--->SensorJsTest_083");
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsAPI--->SensorJsTest_083 [" + i + "] = " + data[i]); console.info("SensorJsAPI--->SensorJsTest_083 [" + i + "] = " + data[i]);
expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[0][0]) && expect( expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[0][0]) && expect(
Number.isNaN(data[1])).assertTrue() && Number.isNaN(data[1])).assertTrue() &&
...@@ -515,7 +515,7 @@ describe("SensorJsTest", function () { ...@@ -515,7 +515,7 @@ describe("SensorJsTest", function () {
[3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, [3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38, 3.40282e+38,
3.40282e+38, 3.40282e+38]).then((data) => { 3.40282e+38, 3.40282e+38]).then((data) => {
console.info("SensorJsAPI--->SensorJsTest_084"); console.info("SensorJsAPI--->SensorJsTest_084");
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsAPI--->SensorJsTest_084 [" + i + "] = " + data[i]); console.info("SensorJsAPI--->SensorJsTest_084 [" + i + "] = " + data[i]);
expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[1][0]) && expect( expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[1][0]) && expect(
Number.isNaN(data[1])).assertTrue() && expect(data[2]).assertEqual( Number.isNaN(data[1])).assertTrue() && expect(data[2]).assertEqual(
...@@ -543,7 +543,7 @@ describe("SensorJsTest", function () { ...@@ -543,7 +543,7 @@ describe("SensorJsTest", function () {
[1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, [1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38, 1.17549e-38,
1.17549e-38]).then((data) => { 1.17549e-38]).then((data) => {
console.info("SensorJsAPI--->SensorJsTest_085"); console.info("SensorJsAPI--->SensorJsTest_085");
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsAPI--->SensorJsTest_085 [" + i + "] = " + data[i]); console.info("SensorJsAPI--->SensorJsTest_085 [" + i + "] = " + data[i]);
expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[2][0]) expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[2][0])
&& expect(data[1]).assertEqual(ANGLECHANGE_9_RESULT[2][1]) && expect(data[1]).assertEqual(ANGLECHANGE_9_RESULT[2][1])
...@@ -572,7 +572,7 @@ describe("SensorJsTest", function () { ...@@ -572,7 +572,7 @@ describe("SensorJsTest", function () {
+ 1, 3.40282e+38 + 1, 3.40282e+38 + 1, 3.40282e+38 + 1]) + 1, 3.40282e+38 + 1, 3.40282e+38 + 1, 3.40282e+38 + 1])
.then((data) => { .then((data) => {
console.info("SensorJsAPI--->SensorJsTest_086"); console.info("SensorJsAPI--->SensorJsTest_086");
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsAPI--->SensorJsTest_086 [" + i + "] = " + data[i]); console.info("SensorJsAPI--->SensorJsTest_086 [" + i + "] = " + data[i]);
expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[3][0]) && expect( expect(data[0]).assertEqual(ANGLECHANGE_9_RESULT[3][0]) && expect(
Number.isNaN(data[1])).assertTrue() && expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[3][2]); Number.isNaN(data[1])).assertTrue() && expect(data[2]).assertEqual(ANGLECHANGE_9_RESULT[3][2]);
...@@ -599,7 +599,7 @@ describe("SensorJsTest", function () { ...@@ -599,7 +599,7 @@ describe("SensorJsTest", function () {
[0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, [0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0, 0.0 / 0.0,
0.0 / 0.0]).then((data) => { 0.0 / 0.0]).then((data) => {
console.info("SensorJsAPI--->SensorJsTest_087"); console.info("SensorJsAPI--->SensorJsTest_087");
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsAPI--->SensorJsTest_087 [" + i + "] = " + data[i]); console.info("SensorJsAPI--->SensorJsTest_087 [" + i + "] = " + data[i]);
expect(Number.isNaN(data[0]) && Number.isNaN(data[1]) && Number.isNaN(data[2])).assertTrue(); expect(Number.isNaN(data[0]) && Number.isNaN(data[1]) && Number.isNaN(data[2])).assertTrue();
} }
...@@ -610,7 +610,7 @@ describe("SensorJsTest", function () { ...@@ -610,7 +610,7 @@ describe("SensorJsTest", function () {
}) })
}) })
var result = [ let result = [
[0.7441122531890869, 0.5199999809265137, -0.335999995470047, -0.25099998712539673], [0.7441122531890869, 0.5199999809265137, -0.335999995470047, -0.25099998712539673],
[0, 3.402820018375656e+38, 3.402820018375656e+38, 3.402820018375656e+38], [0, 3.402820018375656e+38, 3.402820018375656e+38, 3.402820018375656e+38],
[1, 0, 0, 0], [1, 0, 0, 0],
...@@ -632,7 +632,7 @@ describe("SensorJsTest", function () { ...@@ -632,7 +632,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_088 failed'); console.info('SensorJsTest_088 failed');
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("data[" + i + "]: " + data[i]) console.info("data[" + i + "]: " + data[i])
expect(data[i]).assertEqual(result[0][i]) expect(data[i]).assertEqual(result[0][i])
} }
...@@ -654,7 +654,7 @@ describe("SensorJsTest", function () { ...@@ -654,7 +654,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_089 failed'); console.info('SensorJsTest_089 failed');
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("data[" + i + "]: " + data[i]) console.info("data[" + i + "]: " + data[i])
expect(data[i]).assertEqual(result[1][i]) expect(data[i]).assertEqual(result[1][i])
} }
...@@ -676,7 +676,7 @@ describe("SensorJsTest", function () { ...@@ -676,7 +676,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_090 failed'); console.info('SensorJsTest_090 failed');
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("data[" + i + "]: " + data[i]) console.info("data[" + i + "]: " + data[i])
expect(data[i]).assertEqual(result[2][i]) expect(data[i]).assertEqual(result[2][i])
} }
...@@ -699,7 +699,7 @@ describe("SensorJsTest", function () { ...@@ -699,7 +699,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_091 failed'); console.info('SensorJsTest_091 failed');
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("data[" + i + "]: " + data[i]) console.info("data[" + i + "]: " + data[i])
expect(data[i]).assertEqual(result[3][i]) expect(data[i]).assertEqual(result[3][i])
} }
...@@ -739,7 +739,7 @@ describe("SensorJsTest", function () { ...@@ -739,7 +739,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_093 start') console.info('SensorJsTest_093 start')
sensor.createQuaternion([0.52, -0.336, -0.251]).then((data) => { sensor.createQuaternion([0.52, -0.336, -0.251]).then((data) => {
console.info('SensorJsTest_093'); console.info('SensorJsTest_093');
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("data[" + i + "]: " + data[i]); console.info("data[" + i + "]: " + data[i]);
expect(data[i]).assertEqual(result[0][i]) expect(data[i]).assertEqual(result[0][i])
} }
...@@ -782,7 +782,7 @@ describe("SensorJsTest", function () { ...@@ -782,7 +782,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_095 start') console.info('SensorJsTest_095 start')
sensor.createQuaternion([0, 0, 0]).then((data) => { sensor.createQuaternion([0, 0, 0]).then((data) => {
console.info('SensorJsTest_095'); console.info('SensorJsTest_095');
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("data[" + i + "]: " + data[i]); console.info("data[" + i + "]: " + data[i]);
expect(data[i]).assertEqual(result[2][i]) expect(data[i]).assertEqual(result[2][i])
} }
...@@ -805,7 +805,7 @@ describe("SensorJsTest", function () { ...@@ -805,7 +805,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_096 start') console.info('SensorJsTest_096 start')
sensor.createQuaternion([-0.325, -0.562, -0.25]).then((data) => { sensor.createQuaternion([-0.325, -0.562, -0.25]).then((data) => {
console.info('SensorJsTest_096'); console.info('SensorJsTest_096');
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("data[" + i + "]: " + data[i]); console.info("data[" + i + "]: " + data[i]);
expect(data[i]).assertEqual(result[3][i]) expect(data[i]).assertEqual(result[3][i])
} }
...@@ -856,7 +856,7 @@ describe("SensorJsTest", function () { ...@@ -856,7 +856,7 @@ describe("SensorJsTest", function () {
console.info('SensorJsTest_098 failed'); console.info('SensorJsTest_098 failed');
expect(false).assertTrue(); expect(false).assertTrue();
} else { } else {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsTest_098 [" + i + ") = " + data[i]); console.info("SensorJsTest_098 [" + i + ") = " + data[i]);
expect(data[i]).assertEqual(createRotationMatrixResult[0][i]) expect(data[i]).assertEqual(createRotationMatrixResult[0][i])
} }
...@@ -875,7 +875,7 @@ describe("SensorJsTest", function () { ...@@ -875,7 +875,7 @@ describe("SensorJsTest", function () {
it('SensorJsTest_099', 0, async function (done) { it('SensorJsTest_099', 0, async function (done) {
console.info('SensorJsTest_099 start') console.info('SensorJsTest_099 start')
sensor.createRotationMatrix([-0.0245, 0.402, 0.0465]).then((data) => { sensor.createRotationMatrix([-0.0245, 0.402, 0.0465]).then((data) => {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsTest_099 [" + i + "] : " + data[i]); console.info("SensorJsTest_099 [" + i + "] : " + data[i]);
expect(data[i]).assertEqual(createRotationMatrixResult[0][i]) expect(data[i]).assertEqual(createRotationMatrixResult[0][i])
} }
...@@ -897,7 +897,7 @@ describe("SensorJsTest", function () { ...@@ -897,7 +897,7 @@ describe("SensorJsTest", function () {
it('SensorJsTest_100', 0, async function (done) { it('SensorJsTest_100', 0, async function (done) {
console.info('SensorJsTest_100 start') console.info('SensorJsTest_100 start')
sensor.createRotationMatrix([0, 0, 0]).then((data) => { sensor.createRotationMatrix([0, 0, 0]).then((data) => {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsTest_100 [" + i + "] : " + data[i]); console.info("SensorJsTest_100 [" + i + "] : " + data[i]);
expect(data[i]).assertEqual(createRotationMatrixResult[1][i]) expect(data[i]).assertEqual(createRotationMatrixResult[1][i])
} }
...@@ -910,7 +910,7 @@ describe("SensorJsTest", function () { ...@@ -910,7 +910,7 @@ describe("SensorJsTest", function () {
console.info("SensorJsTest_100 end") console.info("SensorJsTest_100 end")
}) })
var getGeomagneticDipResult = [0.8760581016540527, 0.862170, -Infinity, 44330] let getGeomagneticDipResult = [0.8760581016540527, 0.862170, -Infinity, 44330]
/* /*
* @tc.name: SensorJsTest_101 * @tc.name: SensorJsTest_101
...@@ -1099,7 +1099,7 @@ describe("SensorJsTest", function () { ...@@ -1099,7 +1099,7 @@ describe("SensorJsTest", function () {
'axisX': 1, 'axisX': 1,
'axisY': 2 'axisY': 2
}).then((data) => { }).then((data) => {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsTest_109 data[ " + i + "] = " + data[i]); console.info("SensorJsTest_109 data[ " + i + "] = " + data[i]);
expect(data[i]).assertEqual(transformCoordinateSystemResult[0][i]); expect(data[i]).assertEqual(transformCoordinateSystemResult[0][i]);
} }
...@@ -1121,7 +1121,7 @@ describe("SensorJsTest", function () { ...@@ -1121,7 +1121,7 @@ describe("SensorJsTest", function () {
console.info("---------------------------SensorJsTest_110----------------------------------"); console.info("---------------------------SensorJsTest_110----------------------------------");
sensor.transformCoordinateSystem([3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, sensor.transformCoordinateSystem([3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39,
3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39], { 'axisX': 1, 'axisY': 3 }).then((data) => { 3.40282e+39, 3.40282e+39, 3.40282e+39, 3.40282e+39], { 'axisX': 1, 'axisY': 3 }).then((data) => {
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsTest_110 data[ " + i + "] = " + data[i]); console.info("SensorJsTest_110 data[ " + i + "] = " + data[i]);
expect(data[i]).assertEqual(transformCoordinateSystemResult[2][i]); expect(data[i]).assertEqual(transformCoordinateSystemResult[2][i]);
} }
......
...@@ -812,7 +812,7 @@ describe("SensorJsTest", function () { ...@@ -812,7 +812,7 @@ describe("SensorJsTest", function () {
*/ */
it("SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0260", 0, async function (done) { it("SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0260", 0, async function (done) {
console.info("------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0260-------------------------"); console.info("------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0260-------------------------");
for (var i = 0; i < timeMillis.length; i++) { for (let i = 0; i < timeMillis.length; i++) {
await sensor.getGeomagneticField({ 'latitude': 80, 'longitude': 0, 'altitude': 0 }, await sensor.getGeomagneticField({ 'latitude': 80, 'longitude': 0, 'altitude': 0 },
timeMillis[i]).then((data) => { timeMillis[i]).then((data) => {
console.info('SensorGeomagenticAlgorithmJSTest026 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z console.info('SensorGeomagenticAlgorithmJSTest026 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z
...@@ -1130,7 +1130,7 @@ describe("SensorJsTest", function () { ...@@ -1130,7 +1130,7 @@ describe("SensorJsTest", function () {
* @tc.desc:verify app info is not null * @tc.desc:verify app info is not null
*/ */
it('SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0390', 0, async function (done) { it('SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0390', 0, async function (done) {
for (var i = 0; i < timeMillis.length; i++) { for (let i = 0; i < timeMillis.length; i++) {
console.info('------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0390------------------'); console.info('------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0390------------------');
await sensor.getGeomagneticField({ 'latitude': 80, 'longitude': 0, 'altitude': 0 }, await sensor.getGeomagneticField({ 'latitude': 80, 'longitude': 0, 'altitude': 0 },
timeMillis[i]).then((data) => { timeMillis[i]).then((data) => {
...@@ -1259,7 +1259,7 @@ describe("SensorJsTest", function () { ...@@ -1259,7 +1259,7 @@ describe("SensorJsTest", function () {
*/ */
it('SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0450', 0, async function (done) { it('SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0450', 0, async function (done) {
console.info('------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0450------------------'); console.info('------------------SUB_SensorsSystem_GeomagneticAlgorithm_JSTest_0450------------------');
for (var i = 0; i < GEOMAGNETIC_COORDINATES.length; i++) { for (let i = 0; i < GEOMAGNETIC_COORDINATES.length; i++) {
await sensor.getGeomagneticField({ await sensor.getGeomagneticField({
'latitude': GEOMAGNETIC_COORDINATES[i][0], 'latitude': GEOMAGNETIC_COORDINATES[i][0],
'longitude': GEOMAGNETIC_COORDINATES[i][1], 'altitude': GEOMAGNETIC_COORDINATES[i][2] 'longitude': GEOMAGNETIC_COORDINATES[i][1], 'altitude': GEOMAGNETIC_COORDINATES[i][2]
......
...@@ -19,8 +19,8 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from ...@@ -19,8 +19,8 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from
import sensor from '@ohos.sensor' import sensor from '@ohos.sensor'
function sleep(NumberMillis) { function sleep(NumberMillis) {
var now = new Date() let now = new Date()
var exitTime = now.getTime() + NumberMillis let exitTime = now.getTime() + NumberMillis
while (true) { while (true) {
now = new Date() now = new Date()
if (now.getTime > exitTime) { if (now.getTime > exitTime) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册