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 da233a5dbcaab718016f74cad82c044d3274b410..5390acca24e5b95f1f413c94d2e40d6365961768 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(); + }) }) }