From 39be9ab28c17c95e50560f0460db206048f9f783 Mon Sep 17 00:00:00 2001 From: ShiJie Date: Sun, 24 Apr 2022 17:11:12 +0800 Subject: [PATCH] test: Add a semicolon to the statement end point Signed-off-by: ShiJie Change-Id: I448cf398e0d049b87b22ef84fe4efca64a512a7f --- .../js/default/test/system_display.test.js | 324 +++++++++--------- 1 file changed, 162 insertions(+), 162 deletions(-) diff --git a/powermgr/powermgrdisplay/src/main/js/default/test/system_display.test.js b/powermgr/powermgrdisplay/src/main/js/default/test/system_display.test.js index baab83ba4..8d6a2ec8f 100644 --- a/powermgr/powermgrdisplay/src/main/js/default/test/system_display.test.js +++ b/powermgr/powermgrdisplay/src/main/js/default/test/system_display.test.js @@ -13,15 +13,15 @@ * limitations under the License. */ -import brightness from '@system.brightness' -import { describe } from 'deccjsunit/index' +import brightness from '@system.brightness'; +import { describe } from 'deccjsunit/index'; -const INPUT_ERROR_CODE_CODE = 202 -const SET_VALUE_MSG = "setValue: value is not an available number" -const SET_MODE_MSG = "setMode: value is not an available number" +const INPUT_ERROR_CODE_CODE = 202; +const SET_VALUE_MSG = "setValue: value is not an available number"; +const SET_MODE_MSG = "setMode: value is not an available number"; function isNotSupported(data) { - return data == "setMode: Auto adjusting brightness is not supported" + return data === "setMode: Auto adjusting brightness is not supported"; } function sleep(time){ @@ -37,41 +37,41 @@ describe('appInfoTest', function () { * @tc.desc Get brightness success */ it('get_value_success', 0, function () { - let execSucc = false - let execComplete = false + let execSucc = false; + let execComplete = false; let currValue = 100; - let setValue = 120 + let setValue = 120; brightness.getValue({ success: (data) => { - currValue = data.value - let value = (data.value > 0) && (data.value <= 255) + currValue = data.value; + let value = (data.value > 0) && (data.value <= 255); expect(value).assertTrue(); } - }) + }); brightness.setValue({ value: setValue - }) + }); brightness.getValue({ success: (data) => { - execSucc = true - expect(setValue == data.value).assertTrue(); + execSucc = true; + expect(setValue === data.value).assertTrue(); }, fail: (data, code) => { - console.log("get_value_success, data: " + data + ", code: " + code) - expect().assertFail() + console.log("get_value_success, data: " + data + ", code: " + code); + expect().assertFail(); }, complete: () => { - execComplete = true - console.log("The device information is obtained successfully. Procedure") + execComplete = true; + console.log("The device information is obtained successfully. Procedure"); } - }) - expect(execSucc).assertTrue() - expect(execComplete).assertTrue() + }); + expect(execSucc).assertTrue(); + expect(execComplete).assertTrue(); brightness.setValue({ value: currValue - }) - }) + }); + }); /** * @tc.number system_display_js_0101 @@ -79,18 +79,18 @@ describe('appInfoTest', function () { * @tc.desc Get brightness */ it('get_status_test_success_not_must', 0, function () { - let execComplete = false + let execComplete = false; brightness.getValue({ fail: (data, code) => { - console.log("get_status_test_success_not_must, data: " + data + ", code: " + code) - expect().assertFail() + console.log("get_status_test_success_not_must, data: " + data + ", code: " + code); + expect().assertFail(); }, complete: () => { - execComplete = true - console.log("The device information is obtained successfully. Procedure") + execComplete = true; + console.log("The device information is obtained successfully. Procedure"); } - }) - expect(execComplete).assertTrue() + }); + expect(execComplete).assertTrue(); }) /** @@ -99,15 +99,15 @@ describe('appInfoTest', function () { * @tc.desc Get brightness */ it('get_value_fail_not_must_test', 0, function () { - let execComplete = false + let execComplete = false; brightness.getValue({ complete: () => { - execComplete = true - console.log("The device information is obtained successfully. Procedure") + execComplete = true; + console.log("The device information is obtained successfully. Procedure"); } - }) - expect(execComplete).assertTrue() - }) + }); + expect(execComplete).assertTrue(); + }); /** * @tc.number system_display_js_0103 @@ -115,8 +115,8 @@ describe('appInfoTest', function () { * @tc.desc Get brightness */ it('get_status_test_fail_not_must', 0, function () { - brightness.getValue() - expect(true).assertTrue() + brightness.getValue(); + expect(true).assertTrue(); }) /** @@ -125,42 +125,42 @@ describe('appInfoTest', function () { * @tc.desc Set brightness success */ it('set_value_success_all', 0, function () { - let execSucc = false - let execComplete = false - let setValue = 200 - let currValue = 100 + let execSucc = false; + let execComplete = false; + let setValue = 200; + let currValue = 100; brightness.getValue({ success: (data) => { - currValue = data.value + currValue = data.value; } - }) + }); brightness.setValue({ value: setValue, success: () => { - execSucc = true + execSucc = true; brightness.getValue({ success: (data) => { - expect(data.value == setValue).assertTrue() + expect(data.value === setValue).assertTrue(); } - }) + }); }, fail: (data, code) => { - console.log("set_value_success_all, data: " + data + ", code: " + code) - expect().assertFail() + console.log("set_value_success_all, data: " + data + ", code: " + code); + expect().assertFail(); }, complete: () => { - execComplete = true - console.log("The device information is obtained successfully. Procedure") + execComplete = true; + console.log("The device information is obtained successfully. Procedure"); } - }) - expect(execSucc).assertTrue() - expect(execComplete).assertTrue() + }); + expect(execSucc).assertTrue(); + expect(execComplete).assertTrue(); brightness.setValue({ value: currValue - }) - }) + }); + }); /** * @tc.number system_display_js_0201 @@ -168,22 +168,22 @@ describe('appInfoTest', function () { * @tc.desc Set brightness success */ it('set_value_success_value', 0, function () { - let setValue = 50 - let currValue = 100 + let setValue = 50; + let currValue = 100; brightness.getValue({ success: (data) => { - currValue = data.value + currValue = data.value; } - }) - brightness.setValue({ value: setValue }) + }); + brightness.setValue({ value: setValue }); brightness.getValue({ success: (data) => { - console.log("set_value_success_value, brightness: " + data.value) - expect(data.value == setValue).assertTrue() + console.log("set_value_success_value, brightness: " + data.value); + expect(data.value === setValue).assertTrue(); } - }) - brightness.setValue({ value: currValue }) - }) + }); + brightness.setValue({ value: currValue }); + }); /** * @tc.number system_display_js_0202 @@ -191,20 +191,20 @@ describe('appInfoTest', function () { * @tc.desc Set brightness fail */ it('set_value_fail', 0, function () { - let setValue = "50" + let setValue = "50"; brightness.setValue({ value: setValue, success: () => { - console.log("set_value_fail success") - expect().assertFail() + console.log("set_value_fail success"); + expect().assertFail(); }, fail: (data, code) => { - console.log("set_value_fail, data: " + data + ", code: " + code) - expect(code == NPUT_ERROR_CODE).assertTrue() - expect(data == SET_VALUE_MSG).assertTrue() + console.log("set_value_fail, data: " + data + ", code: " + code); + expect(code === NPUT_ERROR_CODE).assertTrue(); + expect(data === SET_VALUE_MSG).assertTrue(); } - }) - }) + }); + }); /** * @tc.number system_display_js_0300 @@ -212,44 +212,44 @@ describe('appInfoTest', function () { * @tc.desc Get mode success */ it('get_mode_success', 0, function () { - let execSucc = false - let execComplete = false - let modeVal = 0 - let exec = true + let execSucc = false; + let execComplete = false; + let modeVal = 0; + let exec = true; brightness.getMode({ success: (data) => { - console.log("get_mode_success: get mode: " + data.mode) - modeVal = data.mode + console.log("get_mode_success: get mode: " + data.mode); + modeVal = data.mode; } - }) + }); brightness.setMode({ mode: modeVal ? 0 : 1, fail: (data, code) => { - console.log("get_mode_success, data: " + data + ", code: " + code) - exec = isNotSupported(data) ? false : true + console.log("get_mode_success, data: " + data + ", code: " + code); + exec = isNotSupported(data) ? false : true; } }) if (!exec) { - return + return; } brightness.getMode({ success: (data) => { - execSucc = true - expect(data.mode == !modeVal).assertTrue() + execSucc = true; + expect(data.mode === !modeVal).assertTrue() ; }, fail: (data, code) => { - console.log("get_mode_success, data: " + data + ", code: " + code) - expect().assertFail() + console.log("get_mode_success, data: " + data + ", code: " + code); + expect().assertFail(); }, complete: () => { - execComplete = true - console.log("The device information is obtained successfully. Procedure") + execComplete = true; + console.log("The device information is obtained successfully. Procedure"); } - }) - expect(execSucc).assertTrue() - expect(execComplete).assertTrue() + }); + expect(execSucc).assertTrue(); + expect(execComplete).assertTrue(); - brightness.setMode({ mode: modeVal }) + brightness.setMode({ mode: modeVal }); }) /** @@ -258,19 +258,19 @@ describe('appInfoTest', function () { * @tc.desc Get mode success is null */ it('get_mode_success_null', 0, function () { - let execComplete = false + let execComplete = false; brightness.getMode({ fail: (data, code) => { - console.log("get_mode_success_null, data: " + data + ", code: " + code) - expect().assertFail() + console.log("get_mode_success_null, data: " + data + ", code: " + code); + expect().assertFail(); }, complete: () => { - execComplete = true - console.log("The device information is obtained successfully. Procedure") + execComplete = true; + console.log("The device information is obtained successfully. Procedure"); } - }) - expect(execComplete).assertTrue() - }) + }); + expect(execComplete).assertTrue(); + }); /** * @tc.number system_display_js_0400 @@ -278,47 +278,47 @@ describe('appInfoTest', function () { * @tc.desc set mode success */ it('set_mode_success', 0, function () { - let execSucc = false - let execComplete = false - let modeVal = 0 + let execSucc = false; + let execComplete = false; + let modeVal = 0; brightness.getMode({ success: (data) => { - modeVal = data.mode + modeVal = data.mode; } - }) + }); brightness.setMode({ mode: modeVal ? 0 : 1, success: () => { - execSucc = true - console.log("set_mode_success success") + execSucc = true; + console.log("set_mode_success success"); brightness.getMode({ success: (data) => { - console.log("set_mode_success, data: " + data.mode) - expect(data.mode == !modeVal).assertTrue() + console.log("set_mode_success, data: " + data.mode); + expect(data.mode === !modeVal).assertTrue(); } - }) + }); }, fail: (data, code) => { if (!isNotSupported(data)) { - console.log("set_mode_success, data: " + data + ", code: " + code) - expect().assertFail() + console.log("set_mode_success, data: " + data + ", code: " + code); + expect().assertFail(); } else { - console.log("set_mode_success not supported") - execSucc = true - expect(isNotSupported(data)).assertTrue() + console.log("set_mode_success not supported"); + execSucc = true; + expect(isNotSupported(data)).assertTrue(); } }, complete: () => { - execComplete = true - console.log("The device information is obtained successfully. Procedure") + execComplete = true; + console.log("The device information is obtained successfully. Procedure"); } - }) - expect(execSucc).assertTrue() - expect(execComplete).assertTrue() + }); + expect(execSucc).assertTrue(); + expect(execComplete).assertTrue(); - brightness.setMode({ mode: modeVal }) - }) + brightness.setMode({ mode: modeVal }); + }); /** * @tc.number system_display_js_0401 @@ -326,24 +326,24 @@ describe('appInfoTest', function () { * @tc.desc set mode fail */ it('set_mode_fail', 0, function () { - let execComplete = false + let execComplete = false; brightness.setMode({ mode: "0", success: () => { - expect().assertFail() + expect().assertFail(); }, fail: (data, code) => { - console.log("set_mode_fail, data: " + data + ", code: " + code) - expect(code == INPUT_ERROR_CODE_CODE).assertTrue() - expect(data == SET_MODE_MSG).assertTrue() + console.log("set_mode_fail, data: " + data + ", code: " + code); + expect(code === INPUT_ERROR_CODE_CODE).assertTrue(); + expect(data === SET_MODE_MSG).assertTrue(); }, complete: () => { - execComplete = true - console.log("The device information is obtained successfully. Procedure") + execComplete = true; + console.log("The device information is obtained successfully. Procedure"); } - }) - expect(execComplete).assertTrue() - }) + }); + expect(execComplete).assertTrue(); + }); /** * @tc.number system_display_js_0500 @@ -351,27 +351,27 @@ describe('appInfoTest', function () { * @tc.desc set keep screen on true */ it('set_keep_screen_on_true', 0, async function () { - let execSucc = false - let execComplete = false - let sleepTime = 35 * 1000 + let execSucc = false; + let execComplete = false; + let sleepTime = 35 * 1000; brightness.setKeepScreenOn({ keepScreenOn: true, success: () => { - execSucc = true + execSucc = true; }, fail: (data, code) => { - console.log("set_keep_screen_on, data: " + data + ", code: " + code) - expect().assertFail() + console.log("set_keep_screen_on, data: " + data + ", code: " + code); + expect().assertFail(); }, complete: () => { - execComplete = true - console.log("The device information is obtained successfully. Procedure") + execComplete = true; + console.log("The device information is obtained successfully. Procedure"); } - }) - expect(execSucc).assertTrue() - expect(execComplete).assertTrue() + }); + expect(execSucc).assertTrue(); + expect(execComplete).assertTrue(); - await sleep(sleepTime) + await sleep(sleepTime); power.isScreenOn().then(screenOn => { console.info('The current screenOn is ' + screenOn); expect(screenOn).assertTrue(); @@ -386,32 +386,32 @@ describe('appInfoTest', function () { * @tc.desc set keep screen on false */ it('set_keep_screen_on_false', 0, async function () { - let execSucc = false - let execComplete = false - let sleepTime = 35 * 1000 + let execSucc = false; + let execComplete = false; + let sleepTime = 35 * 1000; brightness.setKeepScreenOn({ keepScreenOn: false, success: () => { - execSucc = true + execSucc = true; }, fail: (data, code) => { - console.log("set_keep_screen_on_false, data: " + data + ", code: " + code) - expect().assertFail() + console.log("set_keep_screen_on_false, data: " + data + ", code: " + code); + expect().assertFail(); }, complete: () => { - execComplete = true - console.log("The device information is obtained successfully. Procedure") + execComplete = true; + console.log("The device information is obtained successfully. Procedure"); } - }) - expect(execSucc).assertTrue() - expect(execComplete).assertTrue() + }); + expect(execSucc).assertTrue(); + expect(execComplete).assertTrue(); - await sleep(sleepTime) + await sleep(sleepTime); power.isScreenOn().then(screenOn => { console.info('set_keep_screen_on_false The current screenOn is ' + screenOn); expect(screenOn).assertFalse(); }).catch(error => { console.log('set_keep_screen_on_false isScreenOn error: ' + error); - }) - }) -}) \ No newline at end of file + }); + }); +}); -- GitLab