From a88207c64b635274b255e854fe5d44e94e514f35 Mon Sep 17 00:00:00 2001 From: liangzhenyu123 Date: Tue, 30 Aug 2022 10:51:11 +0800 Subject: [PATCH] liangzhenyu6@huawei.com Signed-off-by: liangzhenyu123 --- .../ets/test/PasteBoeadPixelMapJsunit.test.ets | 2 ++ .../js/test/PreferencesCallBackJsunit.test.js | 14 ++++++++++++++ .../js/test/PreferencesPromiseJsunit.test.js | 17 +++++++++++++++++ .../main/js/test/StorageCallBackJsunit.test.js | 13 +++++++++++++ .../main/js/test/StoragePromiseJsunit.test.js | 17 +++++++++++++++++ .../src/main/js/test/StorageSyncJsunit.test.js | 12 ++++++++++++ .../js/test/RdbstoreTransactionJsunit.test.js | 4 ++-- .../main/js/test/RdbstoreUpdateJsunit.test.js | 2 +- 8 files changed, 78 insertions(+), 3 deletions(-) diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoeadPixelMapJsunit.test.ets b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoeadPixelMapJsunit.test.ets index 122710d1c..bf09ad328 100644 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoeadPixelMapJsunit.test.ets +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoeadPixelMapJsunit.test.ets @@ -172,6 +172,8 @@ export default function pasteBoardTest(){ expect(uri).assertEqual(data.getRecordAt(0).uri) expect('text/uri').assertEqual(data.getRecordAt(0).mimeType) console.info(data.getRecordAt(0).mimeType) + console.info(data.getProperty().mimeTypes[0]); + expect("text/uri").assertEqual(data.getProperty().mimeTypes[0]); }) }) }) diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js index e55d79395..5304dcfb3 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js @@ -487,5 +487,19 @@ describe('preferencesCallBackTest', function () { }) done(); }) + + /** + * @tc.name get defaultValue callback interface test + * @tc.number SUB_DDM_Preferences_Get_CallBack_0250 + * @tc.desc get defaultValue callback interface test + */ + it('testPreferencesGetDefValue0173', 0, async function (done) { + await mPreferences.clear(); + await mPreferences.get(KEY_TEST_BOOLEAN_ELEMENT, true, function (err, ret) { + expect(true).assertEqual(ret); + done(); + }) + }) + }) } \ No newline at end of file diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js index 877cb992b..ed3f2692c 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js @@ -450,5 +450,22 @@ describe('preferencesPromiseTest', function () { await promise; done(); }) + + /** + * @tc.name get string promise interface test + * @tc.number SUB_DDM_Preferences_Get_Promise_0210 + * @tc.desc get string promise interface test + */ + it('testPreferencesGetDefValue00162', 0, async function (done) { + await mPreferences.clear(); + const promise = mPreferences.get(KEY_TEST_BOOLEAN_ELEMENT, true); + promise.then((ret) => { + expect(true).assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) }) } \ No newline at end of file diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageCallBackJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageCallBackJsunit.test.js index d4576c2bb..8119b0901 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageCallBackJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageCallBackJsunit.test.js @@ -333,5 +333,18 @@ describe('storageCallBackTest', function () { }); done(); }) + + /** + * @tc.name get defaultValue callback interface test + * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0190 + * @tc.desc get defaultValue callback interface test + */ + it('testGetDefValue0192', 0, async function (done) { + await mPref.clear(); + await mPref.get(KEY_TEST_BOOLEAN_ELEMENT, true, function (err, ret) { + expect(true).assertEqual(ret); + done(); + }) + }) }) } diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StoragePromiseJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StoragePromiseJsunit.test.js index 5f968862f..bddc40215 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StoragePromiseJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StoragePromiseJsunit.test.js @@ -491,5 +491,22 @@ describe('storagePromiseTest', function () { expect(MAX_VALUE_LENGTH).assertEqual(mPref.getSync("test", "defaultvalue")); done(); }) + + /** + * @tc.name get string promise interface test + * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0260 + * @tc.desc get string promise interface test + */ + it('testGetDefValue0260', 0, async function (done) { + await mPref.clear(); + const promise = mPref.get(KEY_TEST_BOOLEAN_ELEMENT, true); + promise.then((ret) => { + expect(true).assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) }) } diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageSyncJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageSyncJsunit.test.js index 75df1645e..35cd4f61a 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageSyncJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageSyncJsunit.test.js @@ -287,4 +287,16 @@ describe('storageSyncTest', function () { mPref.off('change', observer); mPref.putSync(KEY_TEST_STRING_ELEMENT, "abc"); }) + + /** + * @tc.name get defaultValue callback interface test + * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0170 + * @tc.desc get defaultValue callback interface test + */ + it('testGetDefValue001', 0, async function (done) { + await mPref.clear(); + var ret = mPref.getSync(KEY_TEST_BOOLEAN_ELEMENT, true) + expect(ret).assertTrue(); + done(); + }) })} diff --git a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreTransactionJsunit.test.js b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreTransactionJsunit.test.js index 2f7f827d1..5c3a89475 100644 --- a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreTransactionJsunit.test.js +++ b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreTransactionJsunit.test.js @@ -20,7 +20,7 @@ const TAG = "[RDB_JSKITS_TEST]" const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY, " + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)"; const STORE_CONFIG = { - name: "RdbInsertTest.db", + name: "rdbstoreTransactionTest.db", } var rdbStore = undefined; @@ -41,7 +41,7 @@ describe('rdbstoreTransactionTest', function () { console.info(TAG + 'afterEach') await rdbStore.executeSql("DELETE FROM test"); rdbStore = null - await dataRdb.deleteRdbStore("Delete.db"); + await dataRdb.deleteRdbStore("rdbstoreTransactionTest.db"); }) afterAll(async function () { diff --git a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreUpdateJsunit.test.js b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreUpdateJsunit.test.js index 68519afd9..633d856a2 100644 --- a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreUpdateJsunit.test.js +++ b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreUpdateJsunit.test.js @@ -38,7 +38,7 @@ describe('rdbStoreUpdateTest', function () { console.info(TAG + 'afterEach') await rdbStore.executeSql("DELETE FROM test"); rdbStore = null - await dataRdb.deleteRdbStore("Delete.db"); + await dataRdb.deleteRdbStore("UpdataTest.db"); }) afterAll(async function () { -- GitLab