diff --git a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageCallBackJsunit.test.js b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageCallBackJsunit.test.js index 9e744cb9b275c727d56fec2dc7261a20b891c0b5..8b3695a36d3d7e643b152ac5302a761f3bf31b4c 100755 --- a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageCallBackJsunit.test.js +++ b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageCallBackJsunit.test.js @@ -261,4 +261,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 diff --git a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StoragePromiseJsunit.test.js b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StoragePromiseJsunit.test.js index f39ba9a1e84ff3598cd573fdc0db54f32bcd1d85..5b253325ecca264e5a1512a623be7f274370f373 100755 --- a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StoragePromiseJsunit.test.js +++ b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StoragePromiseJsunit.test.js @@ -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