From d1c261ed1c54d14fda36c271a9af21ead638e231 Mon Sep 17 00:00:00 2001 From: lixinyi Date: Thu, 24 Aug 2023 15:21:04 +0800 Subject: [PATCH] xts_acts-crossplatform Signed-off-by: lixinyi --- .../PreferencesCallBackWithError.test.ets | 14 +++++------ .../main/ets/test/PreferencesIgnore.test.ets | 18 +++++++------- .../test/PreferencesPromiseWithError.test.ets | 24 +++++++++---------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/distributeddatamgr/crossplatform/preferencesetstest/src/main/ets/test/PreferencesCallBackWithError.test.ets b/distributeddatamgr/crossplatform/preferencesetstest/src/main/ets/test/PreferencesCallBackWithError.test.ets index fb31cabf1..65f5b20c8 100644 --- a/distributeddatamgr/crossplatform/preferencesetstest/src/main/ets/test/PreferencesCallBackWithError.test.ets +++ b/distributeddatamgr/crossplatform/preferencesetstest/src/main/ets/test/PreferencesCallBackWithError.test.ets @@ -98,7 +98,7 @@ export default function preferencesCallbackWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. Need 2 or 3 parameters!").assertTrue(); + expect(err.code === "401").assertTrue(); done(); console.log("testMpreferencesGet0000 end."); } @@ -126,7 +126,7 @@ export default function preferencesCallbackWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. The type of 'value' must be string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -203,7 +203,7 @@ export default function preferencesCallbackWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. The type of 'value' must be string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); console.log("testMpreferencesHas0001 end."); } @@ -252,7 +252,7 @@ export default function preferencesCallbackWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. Need 2 or 3 parameters!").assertTrue(); + expect(err.code === "401").assertTrue(); done(); console.log("testMpreferencesPut0001 end."); } @@ -339,7 +339,7 @@ export default function preferencesCallbackWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. The type of 'value' must be string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -367,7 +367,7 @@ export default function preferencesCallbackWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. The type of 'value' must be ValueType.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -389,7 +389,7 @@ export default function preferencesCallbackWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. The type of 'value' must be string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); console.log("testMpreferencesDelete0001 end."); } diff --git a/distributeddatamgr/crossplatform/preferencesetstest/src/main/ets/test/PreferencesIgnore.test.ets b/distributeddatamgr/crossplatform/preferencesetstest/src/main/ets/test/PreferencesIgnore.test.ets index 8747ca552..36228f59e 100644 --- a/distributeddatamgr/crossplatform/preferencesetstest/src/main/ets/test/PreferencesIgnore.test.ets +++ b/distributeddatamgr/crossplatform/preferencesetstest/src/main/ets/test/PreferencesIgnore.test.ets @@ -58,7 +58,7 @@ export default function preferencesIgnoreTest() { }); } catch (err) { console.info("testPreferencesGetPreferences001 fail: " + err.message + "code: " + err.code); - expect(err.code === "401" && err.message == "Parameter error. The type of 'name' must be a without path non empty string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -90,7 +90,7 @@ export default function preferencesIgnoreTest() { }); } catch (err) { console.info("testPreferencesDeletePreferences002 fail: " + err.message + "code: " + err.code); - expect(err.code === "401" && err.message === "Parameter error. The type of 'name' must be a without path non empty string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } } @@ -124,7 +124,7 @@ export default function preferencesIgnoreTest() { }); } catch (err) { console.info("testRemovePreferencesFromCache002 fail: " + err.message + "code: " + err.code); - expect(err.code === "401" && err.message === "Parameter error. The type of 'name' must be a without path non empty string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } } @@ -145,7 +145,7 @@ export default function preferencesIgnoreTest() { await dataPreferences.getPreferences(context, -1); } catch (err) { console.info("testGetPreferencesHelper0003 fail: " + err.message + "code: " + err.code); - expect(err.code === "401" && err.message === "Parameter error. The type of 'name' must be a without path non empty string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -164,7 +164,7 @@ export default function preferencesIgnoreTest() { await dataPreferences.getPreferences(context); } catch (err) { console.info("testGetPreferencesHelper0004 fail: " + err.message + "code: " + err.code); - expect(err.code === "401" && err.message === "Parameter error. Need 2 or 3 parameters!").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -184,7 +184,7 @@ export default function preferencesIgnoreTest() { await dataPreferences.removePreferencesFromCache(context); } catch (err) { console.info("testRemovePreferencesFromCacheHelper0002 fail: " + err.message + "code: " + err.code); - expect(err.code === "401" && err.message === "Parameter error. Need 2 or 3 parameters!").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -204,7 +204,7 @@ export default function preferencesIgnoreTest() { await dataPreferences.removePreferencesFromCache(context, -1); } catch (err) { console.info("testRemovePreferencesFromCacheHelper0003 fail: " + err.message + "code: " + err.code); - expect(err.code === "401" && err.message === "Parameter error. The type of 'name' must be a without path non empty string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -224,7 +224,7 @@ export default function preferencesIgnoreTest() { await dataPreferences.deletePreferences(context); } catch (err) { console.info("testPreferencesDeleteHelper0002 fail: " + err.message + "code: " + err.code); - expect(err.code === "401" && err.message === "Parameter error. Need 2 or 3 parameters!").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -244,7 +244,7 @@ export default function preferencesIgnoreTest() { await dataPreferences.deletePreferences(context, -1); } catch (err) { console.info("testPreferencesDeleteHelper0003 fail: " + err.message + "code: " + err.code); - expect(err.code === "401" && err.message === "Parameter error. The type of 'name' must be a without path non empty string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); diff --git a/distributeddatamgr/crossplatform/preferencesetstest/src/main/ets/test/PreferencesPromiseWithError.test.ets b/distributeddatamgr/crossplatform/preferencesetstest/src/main/ets/test/PreferencesPromiseWithError.test.ets index b9951029f..8dbecaa52 100644 --- a/distributeddatamgr/crossplatform/preferencesetstest/src/main/ets/test/PreferencesPromiseWithError.test.ets +++ b/distributeddatamgr/crossplatform/preferencesetstest/src/main/ets/test/PreferencesPromiseWithError.test.ets @@ -127,7 +127,7 @@ export default function preferencesPromiseWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. Need 2 or 3 parameters!").assertTrue(); + expect(err.code === "401").assertTrue(); done(); console.log("testMpreferencesGetPromise0001 end."); } @@ -157,7 +157,7 @@ export default function preferencesPromiseWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. The type of 'value' must be string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -205,7 +205,7 @@ export default function preferencesPromiseWithErrorTest() { mPreference.getSync(1233); } catch (err) { console.log("trycatch1 err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. Need 2 parameters!").assertTrue(); + expect(err.code === "401").assertTrue(); done(); console.log("testMpreferencesGetSyncWithError0001 end."); } @@ -226,7 +226,7 @@ export default function preferencesPromiseWithErrorTest() { mPreference.getSync(-1, KEY_TEST_INT_ELEMENT); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. The type of 'value' must be string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -303,7 +303,7 @@ export default function preferencesPromiseWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. The type of 'value' must be string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); console.log("testMpreferencesHasPromise0001 end."); } @@ -358,7 +358,7 @@ export default function preferencesPromiseWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. Need 2 or 3 parameters!").assertTrue(); + expect(err.code === "401").assertTrue(); done(); console.log("testMpreferencesPutPromise0001 end."); } @@ -451,7 +451,7 @@ export default function preferencesPromiseWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. The type of 'value' must be string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -480,7 +480,7 @@ export default function preferencesPromiseWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. The type of 'value' must be ValueType.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -499,7 +499,7 @@ export default function preferencesPromiseWithErrorTest() { mPreference.putSync(1233); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. Need 2 parameters!").assertTrue(); + expect(err.code === "401").assertTrue(); done(); console.log("testMpreferencesPutSyncWithError0001 end."); } @@ -565,7 +565,7 @@ export default function preferencesPromiseWithErrorTest() { mPreference.putSync(-1, 123); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. The type of 'value' must be string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -584,7 +584,7 @@ export default function preferencesPromiseWithErrorTest() { mPreference.putSync(KEY_TEST_STRING_ELEMENT, null); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. The type of 'value' must be ValueType.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); } }); @@ -611,7 +611,7 @@ export default function preferencesPromiseWithErrorTest() { }); } catch (err) { console.log("trycatch err =" + err + ", code =" + err.code + ", message =" + err.message); - expect(err.code === "401" && err.message === "Parameter error. The type of 'value' must be string.").assertTrue(); + expect(err.code === "401").assertTrue(); done(); console.log("testMpreferencesDeletePromise0001 end."); } -- GitLab