未验证 提交 dd56ec90 编写于 作者: O openharmony_ci 提交者: Gitee

!3182 【Distributeddatamgr】【master】用例优化

Merge pull request !3182 from 梁振宇/master
......@@ -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
......@@ -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 () {
......
......@@ -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';
......
......@@ -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';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册