提交 ca576395 编写于 作者: L liangzhenyu123

liangzhenyu6@huawei.com

Signed-off-by: Nliangzhenyu123 <liangzhenyu6@huawei.com>
上级 ad2c1d9d
......@@ -169,63 +169,6 @@ describe('rdbStoreTest', function () {
done();
console.log(TAG + "************* testRdbStore0005 end *************");
})
/**
* @tc.name rdb store deleteRdbStore
* @tc.number SUB_DDM_AppDataFWK_JSRDB_RdbStore_0060
* @tc.desc rdb store deleteRdbStore
*/
// it('testRdbStore0006', 0, async function (done) {
// console.log(TAG + "************* testRdbStore0006 start *************");
//
// let storePromise = dataRdb.getRdbStore(STORE_CONFIG, 4);
// storePromise.then(async (store) => {
// try {
// await store.executeSql(CREATE_TABLE_TEST);
// let deletePromise = dataRdb.deleteRdbStore("rdbstore.db")
// deletePromise.then(()=>{
// console.log(TAG + "deleteRdbStore promise done" + store);
// expect(true).assertTrue();
// })
// } catch (e) {
// expect(null).assertFail();
// }
// }).catch((err) => {
// expect(null).assertFail();
// })
// await storePromise
// storePromise = null
// done();
// console.log(TAG + "************* testRdbStore0006 end *************");
// })
/**
* @tc.name rdb store deleteRdbStore
* @tc.number SUB_DDM_AppDataFWK_JSRDB_RdbStore_0070
* @tc.desc rdb store deleteRdbStore
*/
it('testRdbStore0007', 0, async function (done) {
console.log(TAG + "************* testRdbStore0007 start *************");
let storePromise = dataRdb.getRdbStore(STORE_CONFIG, 6);
storePromise.then(async (store) => {
try {
await store.executeSql(CREATE_TABLE_TEST);
let deletePromise = dataRdb.deleteRdbStore("rdbstore.db")
deletePromise.then(()=>{
console.log(TAG + "deleteRdbStore promise done" + store);
expect(true).assertTrue();
})
} catch (e) {
expect(null).assertFail();
}
}).catch((err) => {
expect(null).assertFail();
})
await storePromise
storePromise = null
done();
console.log(TAG + "************* testRdbStore0007 end *************");
})
console.log(TAG + "*************Unit Test End*************");
})
\ No newline at end of file
......@@ -21,6 +21,8 @@ const KEY_TEST_LONG_ELEMENT = 'key_test_long';
const KEY_TEST_FLOAT_ELEMENT = 'key_test_float';
const KEY_TEST_BOOLEAN_ELEMENT = 'key_test_boolean';
const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const MAX_KEY_LENGTH = 'X'.repeat(32)
const MAX_VALUE_LENGTH = 'y'.repeat(8191)
var mPref;
describe('storageTest', function () {
......@@ -380,7 +382,7 @@ describe('storageTest', function () {
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0200
* @tc.desc Maximum length of key test
*/
it('testMaxLengthofKety0200', 0, async function(done){
it('testMaxLengthofKey0200', 0, async function(done){
mPref.clearSync();
const promise = mPref.put(MAX_KEY_LENGTH,"value1")
promise.then((ret)=>{
......@@ -449,4 +451,43 @@ describe('storageTest', function () {
await promise;
done();
})
/**
* @tc.name Maximum length of key test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0240
* @tc.desc Maximum length of key test
*/
it('testMaxLengthofKey0240', 0, async function(done){
mPref.putSync(MAX_KEY_LENGTH, "value1");
expect("value1").assertEqual(mPref.getSync(MAX_KEY_LENGTH, "default"));
const promise = mPref.delete(MAX_KEY_LENGTH);
promise.then((ret)=>{
expect("default").assertEqual(mPref.getSync(MAX_KEY_LENGTH,"default"));
}).catch((err)=>{
expect(null).assertFail();
});
await promise;
done();
})
/**
* @tc.name Maximum length of value test
* @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0250
* @tc.desc Maximum length of value test
*/
it('testMaxLengthofValue0250', 0, async function (done) {
mPref.clearSync();
mPref.putSync("test",MAX_VALUE_LENGTH)
const promise = mPref.put("test", "y".repeat(8192));
promise.then((ret) => {
expect(MAX_VALUE_LENGTH).assertEqual(mPref.getSync("test", "defaultvalue"));
}).catch((err) => {
expect(null).assertFail();
});
await promise;
mPref.putSync("test",MAX_VALUE_LENGTH)
expect(MAX_VALUE_LENGTH).assertEqual(mPref.getSync("test", "defaultvalue"));
done();
})
})
......@@ -57,8 +57,8 @@ function statusCallback3(sessionId, networkId, status) {
}
function sleep(delay) {
var start = (new Date()).getTime();
while((new Date()).getTime() - start < delay) {
continue;
while((new Date()).getTime() - start >= delay) {
break;
}
}
......@@ -72,10 +72,10 @@ describe('objectStoreTest', function () {
console.info("====>beforeAll start====");
var appInfo = await bundle.getApplicationInfo('ohos.acts.distributeddataObject', 0, 100);
tokenID = appInfo.accessTokenId;
console.info("accessTokenId" + appInfo.accessTokenId + " bundleName:" + appInfo.name);
console.info(" bundleName:" + appInfo.name);
var atManager = abilityAccessCtrl.createAtManager();
var result = await atManager.grantUserGrantedPermission(tokenID, PERMISSION_USER_NAME, PERMISSION_USER_SET);
console.info("tokenId" + tokenID + " result:" + result);
console.info(" result:" + result);
sleep(TIMEOUT);
console.debug("====>beforeAll end====");
done();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册