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 0c93ad6371b961d940c49896a9f4fc18b2caecb7..1e4257b8b613f09b3171bddec9bf2a62b2fd03cb 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 @@ -15,7 +15,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import storage from '@ohos.data.storage' -const PATH = '/data/test_storage'; +const PATH = '/data/storage/el2/database/test_storage'; const KEY_TEST_INT_ELEMENT = 'key_test_int'; const KEY_TEST_LONG_ELEMENT = 'key_test_long'; const KEY_TEST_FLOAT_ELEMENT = 'key_test_float'; @@ -272,4 +272,49 @@ describe('storageTest', function () { done(); }); }) + + + /** + * @tc.name clear、put、get、flush String callback interface test + * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0120 + * @tc.desc flush String callback interface test + */ + it('testCallback0172', 0, function (done) { + console.log("*******************testCallback0172 begin."); + mPref.clear(function (err, val) { + if(err){ + console.log("*******************clear error: " + err); + expect(false).assertTrue(); + } + mPref.put(KEY_TEST_STRING_ELEMENT, '', function (err, ret) { + if(err){ + console.log("*******************put error: " + err); + expect(false).assertTrue(); + } + console.log("*******************put done."); + mPref.get(KEY_TEST_STRING_ELEMENT, "defaultvalue", function (err, pre) { + if(err){ + console.log("*******************get error: " + err); + expect(false).assertTrue(); + } + expect('').assertEqual(pre); + mPref.flush(function (err, val) { + if(err){ + console.log("*******************flush error: " + err); + expect(false).assertTrue(); + } + mPref.get(KEY_TEST_STRING_ELEMENT, "defaultvalue", function (err, pre2) { + if(err){ + console.log("*******************get error: " + err); + expect(false).assertTrue(); + } + expect('').assertEqual(pre2); + done(); + console.log("*******************testCallback0172 end."); + }) + }); + }) + }); + }); + }) }) \ No newline at end of file diff --git a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageHelperJsunit.test.js b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageHelperJsunit.test.js index fdaa2dc939b21e342e211a0d4c81ab5e90e58db3..b10044ac16436064b9eafd2189229a03720297be 100755 --- a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageHelperJsunit.test.js +++ b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageHelperJsunit.test.js @@ -16,7 +16,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import storage from '@ohos.data.storage' -const PATH = '/data/test_storage'; +const PATH = '/data/storage/el2/database/test_storage'; var mPref; describe('storageTest', function () { 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 cd88b2e5842fb2779bb5e982c9b6481130119fc3..26dc2a26015d59b4e719d6b64fd151503ad58b88 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 @@ -15,7 +15,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import storage from '@ohos.data.storage' -const PATH = '/data/test_storage'; +const PATH = '/data/storage/el2/database/test_storage'; const KEY_TEST_INT_ELEMENT = 'key_test_int'; const KEY_TEST_LONG_ELEMENT = 'key_test_long'; const KEY_TEST_FLOAT_ELEMENT = 'key_test_float'; diff --git a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageSyncJsunit.test.js b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageSyncJsunit.test.js index c40deafa4a857baf223c9f0e132e9543d6900fcc..b6d78104f9a4e1cd485b2a047c8e174487f80c07 100755 --- a/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageSyncJsunit.test.js +++ b/distributeddatamgr/appdatamgrjstest/hap/src/main/js/default/test/StorageSyncJsunit.test.js @@ -15,7 +15,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import storage from '@ohos.data.storage' -const PATH = '/data/test_storage'; +const PATH = '/data/storage/el2/database/test_storage'; const KEY_TEST_INT_ELEMENT = 'key_test_int'; const KEY_TEST_LONG_ELEMENT = 'key_test_long'; const KEY_TEST_FLOAT_ELEMENT = 'key_test_float';