提交 a5bb0bba 编写于 作者: O openharmony_ci 提交者: Gitee

!1238 【Distributeddatamgr】【Master】API覆盖率接口补齐

Merge pull request !1238 from Maowen/master
......@@ -259,4 +259,17 @@ describe('storageTest', function () {
done();
});
})
/**
* @tc.name flush callback interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0010
* @tc.desc flush callback interface test
*/
it('testFluesh00172', 0, async function (done) {
mPref.putSync(KEY_TEST_STRING_ELEMENT, "test");
await mPref.flush(function (err, ret) {
expect("test").assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "default"));
done();
});
})
})
\ No newline at end of file
......@@ -323,4 +323,53 @@ describe('storageTest', function () {
await promise;
done();
})
/**
* @tc.name deleteSync promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0140
* @tc.desc deleteSync promise interface test
*/
it('testPutString0171', 0, async function (done) {
mPref.putSync(KEY_TEST_STRING_ELEMENT, "abc");
const promise = mPref.put(KEY_TEST_STRING_ELEMENT, '');
promise.then((ret) => {
expect('').
assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "default"));
mPref.deleteSync(KEY_TEST_STRING_ELEMENT);
expect("default").
assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "default"));
}).catch((err) => {
expect('').assertFail();
});
await promise;
done();
})
/**
* @tc.name flush promise interface test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0150
* @tc.desc flush promise interface test
*/
it('testFlush00181', 0, async function (done) {
mPref.putSync(KEY_TEST_STRING_ELEMENT, "test");
const promise = mPref.flush();
promise.then((ret) => {
expect("test").
assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "default"));
}).catch((err) => {
expect(null).assertFail();
});
await promise;
done();
})
/**
* @tc.name const test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0150
* @tc.desc const test
*/
it('testConst001', 0, function () {
expect("80").assertEqual(mPref.MAX_KEY_LENHTH);
expect("8192").assertEqual(mPref.MAX_VALUE_LENHTH);
})
})
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册