From 4d861e5954eabb694cd8951663ca09a6f9743dbd Mon Sep 17 00:00:00 2001 From: yuxiaoya2 Date: Tue, 6 Jun 2023 11:08:02 +0800 Subject: [PATCH] =?UTF-8?q?relationalStoreTest=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yuxiaoya2 Change-Id: Ib31ddd3319682c62651b9d0c1190f24b17155b47 --- .../js/test/RelationalStoreJsunit.test.js | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreJsunit.test.js b/distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreJsunit.test.js index 995215488..9cc9f2734 100644 --- a/distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreJsunit.test.js +++ b/distributeddatamgr/relationalStoretest/relationalStoreJstest/hap/src/main/js/test/RelationalStoreJsunit.test.js @@ -313,5 +313,38 @@ describe('relationalStoreTest', function () { console.info(TAG + "************* SUB_DDM_RelationalStore_Version_0020 end *************"); }) + + /** + * @tc.number SUB_DDM_RelationalStore_Different_Version_0010 + * @tc.name Get relational store version test + * @tc.desc relational version + */ + it('SUB_DDM_RelationalStore_Different_Version_0010', 0, async function (done) { + console.info(TAG + "************* SUB_DDM_RelationalStore_Different_Version_0010 start *************"); + const STORE_CONFIGS2 = { + name: "rdbstore.db", + securityLevel: data_Rdb.SecurityLevel.S2 + }; + let store = await data_Rdb.getRdbStore(context, STORE_CONFIG); + console.info(`SUB_DDM_RelationalStore_Different_Version_0010 S1 Get RdbStore successfully.`); + try{ + let promise = data_Rdb.getRdbStore(context, STORE_CONFIGS2); + await promise.then(async (rdbStore) => { + store = rdbStore; + console.info(`SUB_DDM_RelationalStore_Different_Version_0010 Get RdbStore successfully.`); + expect().assertFail(); + }).catch((err) => { + console.error(`SUB_DDM_RelationalStore_Different_Version_0010 Get RdbStore failed, code is ${err.code},message is ${err.message}`); + expect(err.code).assertEqual(14800000); + }) + }catch(error){ + console.error(`SUB_DDM_RelationalStore_Different_Version_0010 Get RdbStore failed error, code is ${error.code},message is ${error.message}`); + expect().assertFail(); + } + await data_Rdb.deleteRdbStore(context, STORE_CONFIG.name); + await data_Rdb.deleteRdbStore(context, STORE_CONFIGS2.name); + done(); + console.info(TAG + "************* SUB_DDM_RelationalStore_Different_Version_0010 end *************"); + }) console.info(TAG + "*************Unit Test End*************"); })} -- GitLab