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

!6657 test: runningLock.create添加入参无效用例

Merge pull request !6657 from qiuxiangdong/cherry-pick-1669195221
......@@ -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();
})
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册