提交 89c5d5fc 编写于 作者: 1 18834416147

<liangzhenyu6@huawei.com>

Signed-off-by: N18834416147 <liangzhenyu6@huawei.com>
上级 139aac14
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import storage from '@ohos.data.storage' 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_INT_ELEMENT = 'key_test_int';
const KEY_TEST_LONG_ELEMENT = 'key_test_long'; const KEY_TEST_LONG_ELEMENT = 'key_test_long';
const KEY_TEST_FLOAT_ELEMENT = 'key_test_float'; const KEY_TEST_FLOAT_ELEMENT = 'key_test_float';
...@@ -272,4 +272,49 @@ describe('storageTest', function () { ...@@ -272,4 +272,49 @@ describe('storageTest', function () {
done(); 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
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import storage from '@ohos.data.storage' import storage from '@ohos.data.storage'
const PATH = '/data/test_storage'; const PATH = '/data/storage/el2/database/test_storage';
var mPref; var mPref;
describe('storageTest', function () { describe('storageTest', function () {
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import storage from '@ohos.data.storage' 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_INT_ELEMENT = 'key_test_int';
const KEY_TEST_LONG_ELEMENT = 'key_test_long'; const KEY_TEST_LONG_ELEMENT = 'key_test_long';
const KEY_TEST_FLOAT_ELEMENT = 'key_test_float'; const KEY_TEST_FLOAT_ELEMENT = 'key_test_float';
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import storage from '@ohos.data.storage' 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_INT_ELEMENT = 'key_test_int';
const KEY_TEST_LONG_ELEMENT = 'key_test_long'; const KEY_TEST_LONG_ELEMENT = 'key_test_long';
const KEY_TEST_FLOAT_ELEMENT = 'key_test_float'; const KEY_TEST_FLOAT_ELEMENT = 'key_test_float';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册