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 309638b95078403fed16745174e59924b647418a..4119ce6c7540e60921690f393a131d598a19c95c 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 @@ -351,11 +351,13 @@ describe('storageTest', function () { * @tc.desc flush promise interface test */ it('testFlush00181', 0, async function (done) { - mPref.putSync(KEY_TEST_STRING_ELEMENT, "test"); - const promise = mPref.flush(); + mPref.clearSync(); + mPref.putSync(KEY_TEST_STRING_ELEMENT, "abc"); + const promise = mPref.put(KEY_TEST_STRING_ELEMENT, 'test'); promise.then((ret) => { - expect("test"). - assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "default")); + expect('test').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue")); + mPref.flush(); + expect('test').assertEqual(mPref.getSync(KEY_TEST_STRING_ELEMENT, "defaultvalue")); }).catch((err) => { expect(null).assertFail(); }); @@ -368,8 +370,11 @@ describe('storageTest', function () { * @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); + it('testConst001', 0, function () { + mPref = storage.getStorageSync(PATH); + console.info("testConstKEY1 " + mPref.MAX_KEY_LENGTH) + console.info("testConstVALUE1 " + mPref.MAX_VALUE_LENGTH) + expect("80").assertEqual(mPref.MAX_KEY_LENGTH); + expect("8192").assertEqual(mPref.MAX_VALUE_LENGTH); }) }) \ No newline at end of file