diff --git a/powermgr/power_manager/src/main/js/test/power_manager_running_lock.test.js b/powermgr/power_manager/src/main/js/test/power_manager_running_lock.test.js index 585108fa3858641050657118efc7202803ce8125..df1b521014ad56be5da6fed067376303a5d36a1b 100644 --- a/powermgr/power_manager/src/main/js/test/power_manager_running_lock.test.js +++ b/powermgr/power_manager/src/main/js/test/power_manager_running_lock.test.js @@ -305,12 +305,31 @@ describe('PowerManagerRunningLockTest', function () { done(); }) + /** + * @tc.number SUB_PowerSystem_PowerManager_JSTest_0140 + * @tc.name Create_Running_Lock_Promise_Invalid_JSTest0130 + * @tc.desc Create lock input invalid value + */ + it('Create_Running_Lock_Promise_Invalid_JSTest0130', 0, async function (done) { + try { + runningLock.create(0, runningLock.RunningLockType.BACKGROUND) + .then((runninglock) => { + expect().assertFail(); + }) + } catch (e) { + console.info('Create_Running_Lock_Promise_Invalid_JSTest0130 code:' + e.code + "msg:" + e.message); + // 401: Invalid input parameter + expect(e.code === 401).assertTrue(); + } + done(); + }) + /** * @tc.number SUB_PowerSystem_PowerManager_JSTest_0140 * @tc.name Create_Running_Lock_Callback_JSTest0140 * @tc.desc Create lock callback */ - it('Create_Running_Lock_Callback_JSTest0140', 0, async function (done) { + it('Create_Running_Lock_Callback_JSTest0140', 0, async function (done) { try { runningLock.create("Create_Running_Lock_Callback_JSTest0140", runningLock.RunningLockType.BACKGROUND, (error, runninglock) => { @@ -324,5 +343,24 @@ describe('PowerManagerRunningLockTest', function () { } done(); }) + + /** + * @tc.number SUB_PowerSystem_PowerManager_JSTest_0150 + * @tc.name Create_Running_Lock_Callback_JSTest0150 + * @tc.desc Create lock input invalid value + */ + it('Create_Running_Lock_Callback_Invalid_JSTest0150', 0, async function (done) { + try { + runningLock.create("Create_Running_Lock_Callback_Invalid_JSTest0150", "invalid", + (error, runninglock) => { + expect().assertFail(); + }); + } catch (e) { + console.info('Create_Running_Lock_Callback_Invalid_JSTest0150 code:' + e.code + "msg:" + e.message); + // 401: Invalid input parameter + expect(e.code === 401).assertTrue(); + } + done(); + }) }) }