提交 6ada1d39 编写于 作者: L liangzhenyu123

用例优化

Signed-off-by: Nliangzhenyu123 <liangzhenyu6@huawei.com>
上级 3e0665b2
......@@ -412,12 +412,36 @@ describe('preferencesV9CallbackTest', async function () {
console.info('SUB_DDM_JSPREFERENCEV9_CALLBACK_1600 key' + key);
};
mPreference.on('change', observer);
mPreference.off('change', observer);
mPreference.off('sschange', observer);
expect(false).assertTrue()
await mPreference.put(KEY_TEST_STRING_ELEMENT, "abb");
await mPreference.flush();
} catch (err) {
console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message)
mPreference.off('change', observer);
}
done();
})
/**
* @tc.name mPreference.off()
* @tc.number SUB_DDM_JSPREFERENCEV9_CALLBACK_1700
* @tc.desc mPreference.off()
*/
it('SUB_DDM_JSPREFERENCEV9_CALLBACK_1700', 0, async function (done) {
console.log("SUB_DDM_JSPREFERENCEV9_CALLBACK_1700 begin.")
try {
var observer = function (key) {
console.info('SUB_DDM_JSPREFERENCEV9_CALLBACK_1700 key' + key);
};
mPreference.on('change', observer);
mPreference.off('change', "observer");
expect(false).assertTrue()
await mPreference.put(KEY_TEST_STRING_ELEMENT, "abb");
await mPreference.flush();
} catch (err) {
console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message)
mPreference.off('change', observer);
}
done();
})
......
......@@ -412,12 +412,36 @@ describe('preferencesV9PromiseTest', async function () {
console.info('SUB_DDM_JSPREFERENCEV9_PROMISE_1600 key' + key);
};
mPreference.on('change', observer);
mPreference.off('change', observer);
mPreference.off('sschange', observer);
expect(false).assertTrue()
await mPreference.put(KEY_TEST_STRING_ELEMENT, "abb");
await mPreference.flush();
} catch (err) {
console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message)
mPreference.off('change', observer);
}
done();
})
/**
* @tc.name mPreference.off()
* @tc.number SUB_DDM_JSPREFERENCEV9_PROMISE_1700
* @tc.desc mPreference.off()
*/
it('SUB_DDM_JSPREFERENCEV9_PROMISE_1700', 0, async function (done) {
console.log("SUB_DDM_JSPREFERENCEV9_PROMISE_1700 begin.")
try {
var observer = function (key) {
console.info('SUB_DDM_JSPREFERENCEV9_PROMISE_1700 key' + key);
};
mPreference.on('change', observer);
mPreference.off('change', "observer");
expect(false).assertTrue()
await mPreference.put(KEY_TEST_STRING_ELEMENT, "abb");
await mPreference.flush();
} catch (err) {
console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message)
mPreference.off('change', observer);
}
done();
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册