未验证 提交 aa954b46 编写于 作者: O openharmony_ci 提交者: Gitee

!8938 【代码上库】【xts_acts】【powermgr】【OpenHarmony-3.2-Release】 power test code optimization

Merge pull request !8938 from kangqiao/OpenHarmony-3.2-Release
...@@ -39,158 +39,151 @@ function completeFunc(tag) { ...@@ -39,158 +39,151 @@ function completeFunc(tag) {
} }
export default function SystemBatteryTest() { export default function SystemBatteryTest() {
describe('SystemBatteryTest', function () { describe('SystemBatteryTest', function () {
console.log("*************System Battery Unit Test Begin*************"); console.log("*************System Battery Unit Test Begin*************");
/** /**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_0010 * @tc.number SUB_PowerSystem_BatteryManager_JSTest_0010
* @tc.name get_status_success_test * @tc.name get_status_success_test
* @tc.desc Battery acquisition kit * @tc.desc Battery acquisition kit
*/ */
const successTest = "get_status_success_test"; it('get_status_success_test', 0, function () {
it(successTest, 0, function () { battery.getStatus({
battery.getStatus({ success: (data) => {
success: (data) => { successFunc(data, successTest);
successFunc(data, successTest); },
}, fail: (data, code) => {
fail: (data, code) => { failFunc(data, code, successTest);
failFunc(data, code, successTest); },
}, complete: () => {
complete: () => { completeFunc(successTest);
completeFunc(successTest); }
} });
}); });
});
/** /**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_0020 * @tc.number SUB_PowerSystem_BatteryManager_JSTest_0020
* @tc.name get_status_success_null_test * @tc.name get_status_success_null_test
* @tc.desc Battery acquisition kit * @tc.desc Battery acquisition kit
*/ */
const successNullTest = "get_status_success_null_test"; it('get_status_success_null_test', 0, function () {
it(successNullTest, 0, function () { battery.getStatus({
battery.getStatus({ success: null,
success: null, fail: (data, code) => {
fail: (data, code) => { failFunc(data, code, successNullTest);
failFunc(data, code, successNullTest); },
}, complete: () => {
complete: () => { completeFunc(successNullTest);
completeFunc(successNullTest); }
} });
}); });
});
/** /**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_0030 * @tc.number SUB_PowerSystem_BatteryManager_JSTest_0030
* @tc.name get_status_success_empty_test * @tc.name get_status_success_empty_test
* @tc.desc Battery acquisition kit * @tc.desc Battery acquisition kit
*/ */
const successEmptyTest = "get_status_success_null_test"; it('get_status_success_empty_test', 0, function () {
it(successEmptyTest, 0, function () { battery.getStatus({
battery.getStatus({ fail: (data, code) => {
fail: (data, code) => { failFunc(data, code, successEmptyTest);
failFunc(data, code, successEmptyTest); },
}, complete: () => {
complete: () => { completeFunc(successEmptyTest);
completeFunc(successEmptyTest); }
} });
}); });
});
/** /**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_0040 * @tc.number SUB_PowerSystem_BatteryManager_JSTest_0040
* @tc.name get_status_fail_null_test * @tc.name get_status_fail_null_test
* @tc.desc Battery acquisition kit * @tc.desc Battery acquisition kit
*/ */
let failNullTest = "get_status_fail_null_test"; it('get_status_fail_null_test', 0, function () {
it(failNullTest, 0, function () { battery.getStatus({
battery.getStatus({ success: (data) => {
success: (data) => { successFunc(data, failNullTest);
successFunc(data, failNullTest); },
}, fail: null,
fail: null, complete: () => {
complete: () => { completeFunc(failNullTest);
completeFunc(failNullTest); }
} });
}); });
});
/** /**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_0050 * @tc.number SUB_PowerSystem_BatteryManager_JSTest_0050
* @tc.name get_status_fail_empty_test * @tc.name get_status_fail_empty_test
* @tc.desc Battery acquisition kit * @tc.desc Battery acquisition kit
*/ */
let failEmptyTest = "get_status_fail_empty_test"; it('get_status_fail_empty_test', 0, function () {
it(failEmptyTest, 0, function () { battery.getStatus({
battery.getStatus({ success: () => {
success: () => { successFunc(data, failEmptyTest);
successFunc(data, failEmptyTest); },
}, complete: () => {
complete: () => { completeFunc(failEmptyTest);
completeFunc(failEmptyTest); }
} });
}); });
});
/** /**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_0060 * @tc.number SUB_PowerSystem_BatteryManager_JSTest_0060
* @tc.name get_status_complete_null_test * @tc.name get_status_complete_null_test
* @tc.desc Battery acquisition kit * @tc.desc Battery acquisition kit
*/ */
let completeNullTest = "get_status_complete_null_test"; it('get_status_complete_null_test', 0, function () {
it(completeNullTest, 0, function () { battery.getStatus({
battery.getStatus({ success: (data) => {
success: (data) => { successFunc(data, completeNullTest);
successFunc(data, completeNullTest); },
}, fail: (data, code) => {
fail: (data, code) => { failFunc(data, code, completeNullTest);
failFunc(data, code, completeNullTest); },
}, complete: null
complete: null });
}); });
});
/** /**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_0070 * @tc.number SUB_PowerSystem_BatteryManager_JSTest_0070
* @tc.name get_status_complete_empty_test * @tc.name get_status_complete_empty_test
* @tc.desc Battery acquisition kit * @tc.desc Battery acquisition kit
*/ */
let completeEmptyTest = "get_status_complete_empty_test"; it('get_status_complete_empty_test', 0, function () {
it(completeEmptyTest, 0, function () { battery.getStatus({
battery.getStatus({ success: (data) => {
success: (data) => { successFunc(data, completeEmptyTest);
successFunc(data, completeEmptyTest); },
}, fail: (data, code) => {
fail: (data, code) => { failFunc(data, code, completeEmptyTest);
failFunc(data, code, completeEmptyTest); }
} });
}); });
});
/** /**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_0080 * @tc.number SUB_PowerSystem_BatteryManager_JSTest_0080
* @tc.name get_status_all_null * @tc.name get_status_all_null
* @tc.desc Battery acquisition kit * @tc.desc Battery acquisition kit
*/ */
it('get_status_all_null', 0, function () { it('get_status_all_null', 0, function () {
let allNull = false; let allNull = false;
battery.getStatus({ battery.getStatus({
success: null, success: null,
fail: null, fail: null,
complete: null, complete: null,
});
expect(!allNull).assertTrue();
}); });
expect(!allNull).assertTrue();
});
/** /**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_0090 * @tc.number SUB_PowerSystem_BatteryManager_JSTest_0090
* @tc.name get_status_all_empty * @tc.name get_status_all_empty
* @tc.desc Battery acquisition kit * @tc.desc Battery acquisition kit
*/ */
it('get_status_all_empty', 0, function () { it('get_status_all_empty', 0, function () {
let allNull = false; let allNull = false;
battery.getStatus(); battery.getStatus();
expect(!allNull).assertTrue(); expect(!allNull).assertTrue();
}); });
}) })
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册