提交 1fa1aca1 编写于 作者: Q qiuxiangdong

test: add create runninglock invalid case

Signed-off-by: Nqiuxiangdong <qiuxiangdong3@huawei.com>
Change-Id: I7680edff91642cf3075762728397a5b8a1cf242c
上级 a52bfa59
...@@ -305,12 +305,31 @@ describe('PowerManagerRunningLockTest', function () { ...@@ -305,12 +305,31 @@ describe('PowerManagerRunningLockTest', function () {
done(); 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.number SUB_PowerSystem_PowerManager_JSTest_0140
* @tc.name Create_Running_Lock_Callback_JSTest0140 * @tc.name Create_Running_Lock_Callback_JSTest0140
* @tc.desc Create lock callback * @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 { try {
runningLock.create("Create_Running_Lock_Callback_JSTest0140", runningLock.RunningLockType.BACKGROUND, runningLock.create("Create_Running_Lock_Callback_JSTest0140", runningLock.RunningLockType.BACKGROUND,
(error, runninglock) => { (error, runninglock) => {
...@@ -324,5 +343,24 @@ describe('PowerManagerRunningLockTest', function () { ...@@ -324,5 +343,24 @@ describe('PowerManagerRunningLockTest', function () {
} }
done(); 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.
先完成此消息的编辑!
想要评论请 注册