提交 6f3ba5ba 编写于 作者: L lina123456

<update>

Signed-off-by: Nlina123456 <shilina6@huawei.com>
上级 fe672134
...@@ -19,7 +19,7 @@ import abilityFeatureAbility from '@ohos.ability.featureAbility' ...@@ -19,7 +19,7 @@ import abilityFeatureAbility from '@ohos.ability.featureAbility'
var context = abilityFeatureAbility.getContext(); var context = abilityFeatureAbility.getContext();
const TEST_BUNDLE_NAME = 'ohos.acts.distributedKvStore'; const TEST_BUNDLE_NAME = 'ohos.acts.distributedKvStore';
const TEST_STORE_ID = 'storeId'; const TEST_STORE_ID = 'SchemaStoreId';
var kvManager = null; var kvManager = null;
var kvStore = null; var kvStore = null;
......
/* /*
* Copyright (C) 2022-2023 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -24,7 +24,7 @@ function sleep(ms) { ...@@ -24,7 +24,7 @@ function sleep(ms) {
} }
export default function relationalStoreTest(context){ export default function relationalStoreTest(context){
describe('relationalStoreTest', function () { describe('relationalStoreTest', function () {
beforeAll(async function () { beforeAll(async function () {
console.info(TAG + 'beforeAll') console.info(TAG + 'beforeAll')
}) })
...@@ -62,13 +62,11 @@ describe('relationalStoreTest', function () { ...@@ -62,13 +62,11 @@ describe('relationalStoreTest', function () {
} catch (err) { } catch (err) {
expect(null).assertFail(); expect(null).assertFail();
} }
await dataRdb.deleteRdbStore(context,"secure.db");
done();
}).catch((err) => { }).catch((err) => {
expect(null).assertFail(); expect(null).assertFail();
}) })
await storePromise
storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db");
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0100 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0100 end *************");
}) })
...@@ -91,13 +89,11 @@ describe('relationalStoreTest', function () { ...@@ -91,13 +89,11 @@ describe('relationalStoreTest', function () {
} catch (err) { } catch (err) {
expect(null).assertFail(); expect(null).assertFail();
} }
await dataRdb.deleteRdbStore(context,"secure.db");
done();
}).catch((err) => { }).catch((err) => {
expect(null).assertFail(); expect(null).assertFail();
}) })
await storePromise
storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db");
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0200 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0200 end *************");
}) })
...@@ -120,13 +116,11 @@ describe('relationalStoreTest', function () { ...@@ -120,13 +116,11 @@ describe('relationalStoreTest', function () {
} catch (err) { } catch (err) {
expect(null).assertFail(); expect(null).assertFail();
} }
await dataRdb.deleteRdbStore(context,"secure.db");
done();
}).catch((err) => { }).catch((err) => {
expect(null).assertFail(); expect(null).assertFail();
}) })
await storePromise
storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db");
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0300 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0300 end *************");
}) })
...@@ -277,13 +271,13 @@ describe('relationalStoreTest', function () { ...@@ -277,13 +271,13 @@ describe('relationalStoreTest', function () {
let deleteResult = false let deleteResult = false
await dataRdb.getRdbStore(context, config).then(async (store) => { await dataRdb.getRdbStore(context, config).then(async (store) => {
console.info(TAG + "create table success") console.info(TAG + "create table success")
})
await dataRdb.deleteRdbStore(context,"secure.db").then(() => { await dataRdb.deleteRdbStore(context,"secure.db").then(() => {
deleteResult = true deleteResult = true
console.info(`${TAG} delete rdb store success,result is ${deleteResult}`) console.info(`${TAG} delete rdb store success,result is ${deleteResult}`)
}); });
expect(deleteResult).assertTrue(); expect(deleteResult).assertTrue();
done(); done();
})
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTORE_PROMISE_0100 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTORE_PROMISE_0100 end *************");
}) })
...@@ -302,19 +296,18 @@ describe('relationalStoreTest', function () { ...@@ -302,19 +296,18 @@ describe('relationalStoreTest', function () {
let deleteResult = false let deleteResult = false
await dataRdb.getRdbStore(context, config).then(async (store) => { await dataRdb.getRdbStore(context, config).then(async (store) => {
console.info(TAG + "create rdb store success") console.info(TAG + "create rdb store success")
})
dataRdb.deleteRdbStore(context,"secure.db", (err, data) => { dataRdb.deleteRdbStore(context,"secure.db", (err, data) => {
if(err == undefined){ if(err == undefined){
deleteResult = true deleteResult = true
console.info(`${TAG} delete rdb store success,result is ${deleteResult}`) console.info(`${TAG} delete rdb store success,result is ${deleteResult}`)
} }
done();
}) })
await sleep(1000) await sleep(1000)
expect(deleteResult).assertTrue(); expect(deleteResult).assertTrue();
done(); done();
})
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTORE_CALLBACK_0100 end *************"); console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTORE_CALLBACK_0100 end *************");
}) })
console.log(TAG + "*************Unit Test End*************"); console.log(TAG + "*************Unit Test End*************");
}) })
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册