diff --git a/communication/wifi_p2p/src/main/js/test/WifiManagerP2PEvent.test.js b/communication/wifi_p2p/src/main/js/test/WifiManagerP2PEvent.test.js index b9d7df2d467e20b42b0a39211ef8c713f710be19..fd1eb6bd0b3e6e11b1289279e06703916be7fa40 100644 --- a/communication/wifi_p2p/src/main/js/test/WifiManagerP2PEvent.test.js +++ b/communication/wifi_p2p/src/main/js/test/WifiManagerP2PEvent.test.js @@ -14,7 +14,6 @@ */ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' - import wifiMg from '@ohos.wifiManager' import osaccount from '@ohos.account.osAccount' import bundle from '@ohos.bundle' @@ -101,7 +100,7 @@ export default function actsWifiManagerEventTest() { CONNECTED : 1, }; let wifiP2PConfig = { - deviceAddress : "00:00:00:00:00:00", + deviceAddress : "22:9b:e6:48:1f:5c", netId : -1, passphrase : "12345678", groupName : "DIRECT-AAAZZZ456", @@ -110,6 +109,7 @@ export default function actsWifiManagerEventTest() { let connectResult = wifiMg.p2pConnect(wifiP2PConfig); let p2pCancelResult = wifiMg.p2pCancelConnect(); await sleep(2000); + console.info("[wifi_test]test p2pCancelConnect successful." ); await wifiMg.getP2pLinkedInfo() .then(data => { let resultLength = Object.keys(data).length; @@ -174,14 +174,12 @@ export default function actsWifiManagerEventTest() { } wifiMg.on(p2pGroupState, p2pPersistentGroupChangeCallback); let WifiP2PConfig = { - deviceAddress : "00:00:00:00:00:00", + deviceAddress : "22:9b:e6:48:1f:5c", netId : -2, passphrase : "12345678", groupName : "DIRECT-AAAZZZ123", goBand : wifiMg.GroupOwnerBand.GO_BAND_AUTO, }; - let createP2pGroupResult = wifiMg.createP2pGroup(WifiP2PConfig); - await (2000); try { await wifiMg.getCurrentP2pGroup() .then(data => { diff --git a/communication/wifi_p2p/src/main/js/test/WifiManagerP2PFunction.test.js b/communication/wifi_p2p/src/main/js/test/WifiManagerP2PFunction.test.js index c36ebdee32e839d24005ab98bc6b19103909d312..4c99b3caf4cc69b3cb23e06c72b62e3ead178a0f 100644 --- a/communication/wifi_p2p/src/main/js/test/WifiManagerP2PFunction.test.js +++ b/communication/wifi_p2p/src/main/js/test/WifiManagerP2PFunction.test.js @@ -84,11 +84,19 @@ export default function actsWifiManagerFunctionTest() { expect(wifiMg.isWifiActive()).assertTrue(); let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig); await sleep(2000); - await wifiMg.getCurrentP2pGroup() - .then(data => { - console.info("[wifi_test]getCurrentP2pGroup promise result -> " + JSON.stringify(data)); - expect(true).assertEqual(data.groupName == wifiP2PConfig.groupName); - }); + try { + await wifiMg.getCurrentP2pGroup() + .then(data => { + console.info("[wifi_test] getCurrentP2pGroup promise result :" + JSON.stringify(data)); + expect(true).assertEqual(data.deviceName == null); + }).catch((error) => { + console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error)); + expect(true).assertEqual(error !=null); + }); + }catch(error){ + console.info("[wifi_test]getCurrentP2pGroup promise error: " + JSON.stringify(error.message)); + expect(true).assertEqual( (JSON.stringify(error.message)) !=null); + } function getCurrentP2pGroupResult(){ return new Promise((resolve, reject) => { wifiMg.getCurrentP2pGroup( @@ -122,11 +130,11 @@ export default function actsWifiManagerFunctionTest() { console.info("[wifi_test] getCurrentP2pGroup promise result1 :" + JSON.stringify(data)); expect(true).assertEqual(data.deviceName == null); }).catch((error) => { - console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error)); + console.error('[wifi_test] getCurrentP2pGroup promise failed1 :' + JSON.stringify(error)); expect(true).assertEqual(error !=null); }); }catch(error){ - console.info("[wifi_test]getCurrentP2pGroup promise error: " + JSON.stringify(error.message)); + console.info("[wifi_test]getCurrentP2pGroup promise error1: " + JSON.stringify(error.message)); expect(true).assertEqual( (JSON.stringify(error.message)) !=null); } done(); @@ -149,18 +157,33 @@ export default function actsWifiManagerFunctionTest() { groupName: "DIRECT-test_pass", goBand: wifiMg.GroupOwnerBand.GO_BAND_2GHZ, }; - let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig); - await sleep(2000); - await wifiMg.getCurrentP2pGroup() - .then(data => { - console.info("[wifi_test] getCurrentP2pGroup promise result :" + JSON.stringify(data)); - expect(true).assertEqual(data.networkId == -999); - }).catch((error) => { - console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error)); - expect(true).assertEqual(error !=null); - }); - let removeP2pGroupResult = wifiMg.removeP2pGroup(); - await sleep(2000); + try { + let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig); + await sleep(2000); + }catch(error){ + console.info("[wifi_test]createP2pGroup error: " + JSON.stringify(error.message)); + expect(true).assertEqual( (JSON.stringify(error.message)) !=null); + } + try { + await wifiMg.getCurrentP2pGroup() + .then(data => { + console.info("[wifi_test] getCurrentP2pGroup promise result :" + JSON.stringify(data)); + expect(true).assertEqual(data.networkId == -999); + }).catch((error) => { + console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error)); + expect(true).assertEqual(error !=null); + }); + }catch(error){ + console.info("[wifi_test]getCurrentP2pGroup promise error: " + JSON.stringify(error.message)); + expect(true).assertEqual( (JSON.stringify(error.message)) !=null); + } + try { + let removeP2pGroupResult = wifiMg.removeP2pGroup(); + await sleep(2000); + }catch(error){ + console.info("[wifi_test]removeP2pGroup error: " + JSON.stringify(error.message)); + expect(true).assertEqual( (JSON.stringify(error.message)) !=null); + } try { await wifiMg.getCurrentP2pGroup() .then(data => { @@ -171,7 +194,7 @@ export default function actsWifiManagerFunctionTest() { expect(true).assertEqual(error !=null); }); }catch(error){ - console.info("[wifi_test]getCurrentP2pGroup promise error: " + JSON.stringify(error.message)); + console.info("[wifi_test]getCurrentP2pGroup promise error1: " + JSON.stringify(error.message)); expect(true).assertEqual( (JSON.stringify(error.message)) !=null); } done(); @@ -278,18 +301,33 @@ export default function actsWifiManagerFunctionTest() { groupName: "DIRECT-test_pass3", goBand: wifiMg.GroupOwnerBand.GO_BAND_2GHZ, }; - let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig); - await sleep(2000); - await wifiMg.getCurrentP2pGroup() - .then(data => { - console.info("[wifi_test]getCurrentP2pGroup promise result :" + JSON.stringify(data)); - expect(true).assertEqual(data.passphrase != wifiP2PConfig.passphrase); - }).catch((error) => { - console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error)); - expect(true).assertEqual(error !=null); - }); - let removeP2pGroupResult = wifiMg.removeP2pGroup(); - await sleep(2000); + try { + let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig); + await sleep(2000); + }catch(error){ + console.info("[wifi_test]createP2pGroup error: " + JSON.stringify(error.message)); + expect(true).assertEqual( (JSON.stringify(error.message)) !=null); + } + try { + await wifiMg.getCurrentP2pGroup() + .then(data => { + console.info("[wifi_test] getCurrentP2pGroup promise result :" + JSON.stringify(data)); + expect(true).assertEqual(data.networkId == -999); + }).catch((error) => { + console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error)); + expect(true).assertEqual(error !=null); + }); + }catch(error){ + console.info("[wifi_test]getCurrentP2pGroup promise error: " + JSON.stringify(error.message)); + expect(true).assertEqual( (JSON.stringify(error.message)) !=null); + } + try { + let removeP2pGroupResult = wifiMg.removeP2pGroup(); + await sleep(2000); + }catch(error){ + console.info("[wifi_test]removeP2pGroup error: " + JSON.stringify(error.message)); + expect(true).assertEqual( (JSON.stringify(error.message)) !=null); + } try { await wifiMg.getCurrentP2pGroup() .then(data => { @@ -371,7 +409,10 @@ export default function actsWifiManagerFunctionTest() { await wifiMg.getCurrentP2pGroup() .then(data => { console.info("[wifi_test] getCurrentP2pGroup promise result :" + JSON.stringify(data)); - expect(true).assertEqual(5160 < data.frequency < 5865); + expect(true).assertEqual(data.deviceName == null); + }).catch((error) => { + console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error)); + expect(true).assertEqual(error !=null); }); let removeP2pGroupResult = await wifiMg.removeP2pGroup(); await sleep(2000); @@ -380,11 +421,11 @@ export default function actsWifiManagerFunctionTest() { console.info("[wifi_test] getCurrentP2pGroup promise result1 :" + JSON.stringify(data)); expect(true).assertEqual(data.deviceName == null); }).catch((error) => { - console.error('[wifi_test] getCurrentP2pGroup promise failed :' + JSON.stringify(error)); + console.error('[wifi_test] getCurrentP2pGroup promise failed1 :' + JSON.stringify(error)); expect(true).assertEqual(error !=null); }); }catch(error){ - console.info("[wifi_test]createP2pGroup 5G goBand result : " + JSON.stringify(error.message)); + console.info("[wifi_test]createP2pGroup 5G goBand fail : " + JSON.stringify(error.message)); expect(true).assertEqual( (JSON.stringify(error.message)) !=null); } done(); @@ -450,13 +491,13 @@ export default function actsWifiManagerFunctionTest() { groupName: "", goBand: wifiMg.GroupOwnerBand.GO_BAND_2GHZ, }; - let createP2pGroupResult = wifi.createP2pGroup(wifiP2PConfig); + let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig); await sleep(2000); - await wifi.getCurrentP2pGroup() + await wifiMg.getCurrentP2pGroup() .then(data => { console.info("[wifi_test]getCurrentP2pGroup promise result : " + JSON.stringify(data)); }); - let removeP2pGroupResult = wifi.removeP2pGroup(); + let removeP2pGroupResult = wifiMg.removeP2pGroup(); await sleep(2000); await wifiMg.getCurrentP2pGroup() .then(data => { @@ -491,9 +532,9 @@ export default function actsWifiManagerFunctionTest() { groupName: " ", goBand: wifiMg.GroupOwnerBand.GO_BAND_2GHZ, }; - let createP2pGroupResult = wifi.createP2pGroup(wifiP2PConfig); + let createP2pGroupResult = wifiMg.createP2pGroup(wifiP2PConfig); await sleep(2000); - await wifi.getCurrentP2pGroup() + await wifiMg.getCurrentP2pGroup() .then(data => { console.info("[wifi_test]getCurrentP2pGroup promise result :" + JSON.stringify(data)); }); @@ -575,8 +616,12 @@ export default function actsWifiManagerFunctionTest() { let p2pCancelResult = wifiMg.p2pCancelConnect(); await sleep(2000); console.info("[wifi_test]test p2pCancelConnect successful." ); - let removeP2pGroupResult = wifiMg.removeP2pGroup(); - console.info("[wifi_test]test removeP2pGroup successful " ); + try { + let removeP2pGroupResult = wifiMg.removeP2pGroup(); + }catch(error){ + console.info("[wifi_test]removeP2pGroup error: " + JSON.stringify(error.message)); + expect(true).assertEqual( (JSON.stringify(error.message)) !=null); + } try { await wifiMg.getCurrentP2pGroup() .then(data => { @@ -601,7 +646,12 @@ export default function actsWifiManagerFunctionTest() { * @tc.level Level 3 */ it('SUB_Communication_WiFi_XTS_P2P_0011', 0, async function (done) { - let removeP2pGroupResult = wifiMg.removeP2pGroup(10000); + try { + let removeP2pGroupResult = wifiMg.removeP2pGroup(10000); + }catch(error){ + console.info("[wifi_test]removeP2pGroup error: " + JSON.stringify(error.message)); + expect(true).assertEqual( (JSON.stringify(error.message)) !=null); + } try { await wifiMg.getCurrentP2pGroup() .then(data => { diff --git a/communication/wifi_p2p/src/main/js/test/WifiP2PEvent.test.js b/communication/wifi_p2p/src/main/js/test/WifiP2PEvent.test.js index 7c9560442b989e3cf35d6a25e7ca5b8f193708a7..3cbc975e87ab4eec9a6592b6ac49589ae1bef35d 100644 --- a/communication/wifi_p2p/src/main/js/test/WifiP2PEvent.test.js +++ b/communication/wifi_p2p/src/main/js/test/WifiP2PEvent.test.js @@ -97,7 +97,7 @@ export default function actsWifiEventTest() { } wifi.on(p2pConnectionState, p2pConnectionChangeCallback); let wifiP2PConfig = { - deviceAddress : "00:00:00:00:00:00", + deviceAddress : "22:9b:e6:48:1f:5c", netId : -1, passphrase : "12345678", groupName : "DIRECT-AAAZZZ456", @@ -174,16 +174,12 @@ export default function actsWifiEventTest() { } wifi.on(p2pGroupState, p2pPersistentGroupChangeCallback); let WifiP2PConfig = { - deviceAddress : "00:00:00:00:00:00", + deviceAddress : "22:9b:e6:48:1f:5c", netId : -2, passphrase : "12345678", groupName : "DIRECT-AAAZZZ123", goBand : wifi.GroupOwnerBand.GO_BAND_AUTO, }; - let createGroupResult = wifi.createGroup(WifiP2PConfig); - await (2000); - console.info("[wifi_test] test createGroup result." + createGroupResult) - expect(createGroupResult).assertTrue(); try { await wifi.getCurrentGroup() .then(data => { diff --git a/communication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js b/communication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js index 95f091604cd4a342d0c4d040335f1c6975db66c0..0a9a517fe938fa727e4c24de04dc9d9c545b8825 100644 --- a/communication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js +++ b/communication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js @@ -81,16 +81,24 @@ export default function actsWifiFunctionTest() { goBand : wifi.GroupOwnerBand.GO_BAND_2GHZ, }; console.log("[wifi_test]check the state of wifi: " + wifi.isWifiActive()); - expect(wifi .isWifiActive()).assertTrue(); + expect(wifi.isWifiActive()).assertTrue(); let createGroupResult = wifi.createGroup(wifiP2PConfig); console.log("[wifi_test]createGroup result: " + JSON.stringify(createGroupResult)); await sleep(2000); expect(createGroupResult).assertTrue(); - await wifi.getCurrentGroup() - .then(data => { - console.info("[wifi_test]getCurrentGroup promise result -> " + JSON.stringify(data)); - expect(true).assertEqual(data.groupName == wifiP2PConfig.groupName); - }); + try { + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test] getCurrentGroup promise result :" + JSON.stringify(data)); + expect(true).assertEqual(data.groupName == wifiP2PConfig.groupName); + }).catch((error) => { + console.error('[wifi_test] getCurrentGroup promise failed :' + JSON.stringify(error)); + expect(true).assertEqual(error != null); + }); + }catch(error){ + console.info("[wifi_test]getCurrentGroup promise error: " + JSON.stringify(error.message)); + expect(true).assertEqual( (JSON.stringify(error.message)) !=null); + } function getCurrentGroupResult(){ return new Promise((resolve, reject) => { wifi.getCurrentGroup( @@ -125,11 +133,11 @@ export default function actsWifiFunctionTest() { console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); expect(true).assertEqual(data.deviceName == null); }).catch((error) => { - console.error('[wifi_test] getCurrentGroup promise failed :' + JSON.stringify(error)); - expect(true).assertEqual(error !=null); + console.error('[wifi_test] getCurrentGroup promise failed1 :' + JSON.stringify(error)); + expect(true).assertEqual(error != null); }); }catch(error){ - console.info("[wifi_test]getCurrentGroup promise error: " + JSON.stringify(error.message)); + console.info("[wifi_test]getCurrentGroup promise error1: " + JSON.stringify(error.message)); expect(true).assertEqual( (JSON.stringify(error.message)) !=null); } done(); @@ -155,7 +163,7 @@ export default function actsWifiFunctionTest() { let createGroupResult = wifi.createGroup(wifiP2PConfig); console.info("[wifi_test]test createGroup end." + JSON.stringify(createGroupResult)); await sleep(2000); - expect(createGroupResult).assertTrue(); + expect(createGroupResult).assertFalse(); await wifi.getCurrentGroup() .then(data => { console.info("[wifi_test] getCurrentGroup promise result :" + JSON.stringify(data)); @@ -166,7 +174,7 @@ export default function actsWifiFunctionTest() { }); let removeGroupResult = wifi.removeGroup(); await sleep(2000); - expect(removeGroupResult).assertTrue(); + expect(removeGroupResult).assertFalse(); try { await wifi.getCurrentGroup() .then(data => { @@ -293,7 +301,7 @@ export default function actsWifiFunctionTest() { let createGroupResult = wifi.createGroup(wifiP2PConfig); console.info("[wifi_test]test createGroup end." + JSON.stringify(createGroupResult)); await sleep(2000); - expect(createGroupResult).assertTrue(); + expect(createGroupResult).assertFalse(); await wifi.getCurrentGroup() .then(data => { console.info("[wifi_test]getCurrentGroup promise result :" + JSON.stringify(data)); @@ -304,7 +312,7 @@ export default function actsWifiFunctionTest() { }); let removeGroupResult = wifi.removeGroup(); await sleep(2000); - expect(removeGroupResult).assertTrue(); + expect(removeGroupResult).assertFalse(); try { await wifi.getCurrentGroup() .then(data => { @@ -391,7 +399,10 @@ export default function actsWifiFunctionTest() { await wifi.getCurrentGroup() .then(data => { console.info("[wifi_test] getCurrentGroup promise result :" + JSON.stringify(data)); - expect(true).assertEqual(5160 < data.frequency < 5865); + expect(true).assertEqual(data.deviceName == null); + }).catch((error) => { + console.error('[wifi_test] getCurrentGroup promise failed :' + JSON.stringify(error)); + expect(true).assertEqual(error != null); }); let removeGroupResult = await wifi.removeGroup(); await sleep(2000); @@ -401,11 +412,11 @@ export default function actsWifiFunctionTest() { console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); expect(true).assertEqual(data.deviceName == null); }).catch((error) => { - console.error('[wifi_test] getCurrentGroup promise failed :' + JSON.stringify(error)); - expect(true).assertEqual(error !=null); + console.error('[wifi_test] getCurrentGroup promise failed1 :' + JSON.stringify(error)); + expect(true).assertEqual(error != null); }); }catch(error){ - console.info("[wifi_test]createGroup 5G goBand result : " + JSON.stringify(error.message)); + console.info("[wifi_test]createGroup 5G goBand fail : " + JSON.stringify(error.message)); expect(true).assertEqual( (JSON.stringify(error.message)) !=null); } done(); @@ -479,7 +490,7 @@ export default function actsWifiFunctionTest() { expect(p2pCancelResult).assertTrue(); let removeGroupResult = wifi.removeGroup(); console.info("[wifi_test]test start removeGroup:" + removeGroupResult); - expect(removeGroupResult).assertTrue(); + expect(removeGroupResult).assertFalse(); try { await wifi.getCurrentGroup() .then(data => { @@ -506,7 +517,7 @@ export default function actsWifiFunctionTest() { it('Communication_WiFi_XTS_P2P_0011', 0, async function (done) { let removeGroupResult = wifi.removeGroup(10000); console.info("[wifi_test]removeGroup(10000) result : " + JSON.stringify(removeGroupResult)); - expect(removeGroupResult).assertTrue(); + expect(removeGroupResult).assertFalse(); try { await wifi.getCurrentGroup() .then(data => { diff --git a/communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js b/communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js index 42bed2f24405b10eea2a86aaf4845177d7850cf7..aafa6733c46a90180ab746097c85a60f6fa543dc 100644 --- a/communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js +++ b/communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js @@ -53,14 +53,6 @@ function resolveIP(ip) { return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); } -let wifiSecurityType = { - WIFI_SEC_TYPE_INVALID: 0, - WIFI_SEC_TYPE_OPEN: 1, - WIFI_SEC_TYPE_WEP: 2, - WIFI_SEC_TYPE_PSK: 3, - WIFI_SEC_TYPE_SAE: 4, -} - export default function actsWifiCandidateNetWorkTest() { describe('actsWifiCandidateNetWorkTest', function () { beforeAll(async function (done) { @@ -88,7 +80,7 @@ export default function actsWifiCandidateNetWorkTest() { "bssid": "22:9b:e6:48:1f:5c", "preSharedKey": "12345678", "isHiddenSsid": false, - "securityType": wifiSecurityType.WIFI_SEC_TYPE_PSK, + "securityType": wifi.WifiSecurityType.WIFI_SEC_TYPE_PSK, }; await wifi.addUntrustedConfig(wifiDeviceConfig) .then(ret => { @@ -104,6 +96,19 @@ export default function actsWifiCandidateNetWorkTest() { }).catch((error) => { console.error('[wifi_test]removeUntrustedConfig promise failed -> ' + JSON.stringify(error)); }); + + let WIFI_SEC_TYPE_INVALID = wifi.WifiSecurityType.WIFI_SEC_TYPE_INVALID; + console.info("[wifi_test]WIFI_SEC_TYPE_INVALID : " + JSON.stringify(WIFI_SEC_TYPE_INVALID)); + expect(true).assertEqual( WIFI_SEC_TYPE_INVALID == 0); + let WIFI_SEC_TYPE_OPEN = wifi.WifiSecurityType.WIFI_SEC_TYPE_OPEN; + console.info("[wifi_test]WIFI_SEC_TYPE_OPEN : " + JSON.stringify(WIFI_SEC_TYPE_OPEN)); + expect(true).assertEqual( WIFI_SEC_TYPE_OPEN == 1); + let WIFI_SEC_TYPE_WEP = wifi.WifiSecurityType.WIFI_SEC_TYPE_WEP; + console.info("[wifi_test]WIFI_SEC_TYPE_WEP : " + JSON.stringify(WIFI_SEC_TYPE_WEP)); + expect(true).assertEqual( WIFI_SEC_TYPE_WEP == 2); + let WIFI_SEC_TYPE_SAE = wifi.WifiSecurityType.WIFI_SEC_TYPE_SAE; + console.info("[wifi_test]WIFI_SEC_TYPE_SAE : " + JSON.stringify(WIFI_SEC_TYPE_SAE)); + expect(true).assertEqual( WIFI_SEC_TYPE_SAE == 4); done(); }) @@ -120,7 +125,7 @@ export default function actsWifiCandidateNetWorkTest() { "bssid": "22:9b:e6:48:1f:5c", "preSharedKey": "12345678", "isHiddenSsid": false, - "securityType": wifiSecurityType.WIFI_SEC_TYPE_PSK, + "securityType": wifi.WifiSecurityType.WIFI_SEC_TYPE_PSK, } function addCandidate() { return new Promise((resolve, reject) => { diff --git a/communication/wifi_standard/src/main/js/test/WifiManagerCandidateNetWork.test.js b/communication/wifi_standard/src/main/js/test/WifiManagerCandidateNetWork.test.js index 8cbc3d30c275a81f0815714fb874f23bb574a074..1de61ae30248126d41928b928382db26fdcc43ed 100644 --- a/communication/wifi_standard/src/main/js/test/WifiManagerCandidateNetWork.test.js +++ b/communication/wifi_standard/src/main/js/test/WifiManagerCandidateNetWork.test.js @@ -53,15 +53,6 @@ function resolveIP(ip) { return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); } -let wifiSecurityType = { - WIFI_SEC_TYPE_INVALID: 0, - WIFI_SEC_TYPE_EAP: 5, - WIFI_SEC_TYPE_EAP_SUITE_B: 6, - WIFI_SEC_TYPE_OWE:7 , - WIFI_SEC_TYPE_WAPI_CERT:8 , - WIFI_SEC_TYPE_WAPI_PSK:9 , -} - export default function actsWifiManagerCandidateNetWorkTest() { describe('actsWifiManagerCandidateNetWorkTest', function () { beforeAll(async function (done) { @@ -117,6 +108,25 @@ export default function actsWifiManagerCandidateNetWorkTest() { expect(true).assertEqual( (JSON.stringify(error)) !=null); }); console.info("[wifi_test]wifi get WEP CandidateConfigs result : " + JSON.stringify(getconfig)); + + let WIFI_SEC_TYPE_INVALID = wifiMg.WifiSecurityType.WIFI_SEC_TYPE_INVALID; + console.info("[wifi_test]WIFI_SEC_TYPE_INVALID : " + JSON.stringify(WIFI_SEC_TYPE_INVALID)); + expect(true).assertEqual( WIFI_SEC_TYPE_INVALID == 0); + let WIFI_SEC_TYPE_EAP = wifiMg.WifiSecurityType.WIFI_SEC_TYPE_EAP; + console.info("[wifi_test]WIFI_SEC_TYPE_EAP : " + JSON.stringify(WIFI_SEC_TYPE_EAP)); + expect(true).assertEqual( WIFI_SEC_TYPE_EAP == 5); + let WIFI_SEC_TYPE_EAP_SUITE_B = wifiMg.WifiSecurityType.WIFI_SEC_TYPE_EAP_SUITE_B; + console.info("[wifi_test]WIFI_SEC_TYPE_EAP_SUITE_B : " + JSON.stringify(WIFI_SEC_TYPE_EAP_SUITE_B)); + expect(true).assertEqual( WIFI_SEC_TYPE_EAP_SUITE_B == 6); + let WIFI_SEC_TYPE_OWE = wifiMg.WifiSecurityType.WIFI_SEC_TYPE_OWE; + console.info("[wifi_test]WIFI_SEC_TYPE_OWE : " + JSON.stringify(WIFI_SEC_TYPE_OWE)); + expect(true).assertEqual( WIFI_SEC_TYPE_OWE == 7); + let WIFI_SEC_TYPE_WAPI_CERT = wifiMg.WifiSecurityType.WIFI_SEC_TYPE_WAPI_CERT; + console.info("[wifi_test]WIFI_SEC_TYPE_WAPI_CERT : " + JSON.stringify(WIFI_SEC_TYPE_WAPI_CERT)); + expect(true).assertEqual( WIFI_SEC_TYPE_WAPI_CERT == 8); + let WIFI_SEC_TYPE_WAPI_PSK = wifiMg.WifiSecurityType.WIFI_SEC_TYPE_WAPI_PSK; + console.info("[wifi_test]WIFI_SEC_TYPE_WAPI_CERT : " + JSON.stringify(WIFI_SEC_TYPE_WAPI_PSK)); + expect(true).assertEqual( WIFI_SEC_TYPE_WAPI_PSK == 9); done(); }) diff --git a/communication/wifi_standard/src/main/js/test/WifiManagerStationEvent.test.js b/communication/wifi_standard/src/main/js/test/WifiManagerStationEvent.test.js index 145ba15e9522a65f3d25f5ff8ad001d85ce21bc6..ed651334d345a732f00fe94dce8614d8c3734002 100644 --- a/communication/wifi_standard/src/main/js/test/WifiManagerStationEvent.test.js +++ b/communication/wifi_standard/src/main/js/test/WifiManagerStationEvent.test.js @@ -16,7 +16,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import wifiMg from '@ohos.wifiManager' - import wifiManagerExt from '@ohos.wifiManagerExt' import osaccount from '@ohos.account.osAccount' import bundle from '@ohos.bundle' diff --git a/communication/wifi_standard/src/main/js/test/WifiManagerStationFunctions.test.js b/communication/wifi_standard/src/main/js/test/WifiManagerStationFunctions.test.js index 6184af00a5b88c175ab403d1f28ee0a691d61ae2..b8cc6947ae2e85473446f285e03d6ec71eb7a217 100644 --- a/communication/wifi_standard/src/main/js/test/WifiManagerStationFunctions.test.js +++ b/communication/wifi_standard/src/main/js/test/WifiManagerStationFunctions.test.js @@ -53,15 +53,6 @@ function resolveIP(ip) { return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); } -let wifiChannelWidth = { - WIDTH_20MHZ : 0, - WIDTH_40MHZ : 1, - WIDTH_80MHZ : 2, - WIDTH_160MHZ : 3, - WIDTH_80MHZ_PLUS : 4, - WIDTH_INVALID:null, -} - export default function actsWifiManagerFunctionsTest() { describe('actsWifiManagerFunctionsTest', function() { beforeAll(async function (done) { @@ -139,6 +130,25 @@ export default function actsWifiManagerFunctionsTest() { let countrylenth = getCountryCodeResult.length; console.info("[wifi_test]getCountryCode.length :" + JSON.stringify(countrylenth)); expect(true).assertEqual(countrylenth == 2); + + let WIDTH_20MHZ = wifiMg.WifiChannelWidth .WIDTH_20MHZ; + console.info("[wifi_test]WIDTH_20MHZ : " + JSON.stringify(WIDTH_20MHZ)); + expect(true).assertEqual( WIDTH_20MHZ == 0); + let WIDTH_40MHZ = wifiMg.WifiChannelWidth .WIDTH_40MHZ; + console.info("[wifi_test]WIDTH_40MHZ : " + JSON.stringify(WIDTH_40MHZ)); + expect(true).assertEqual( WIDTH_40MHZ == 1); + let WIDTH_80MHZ = wifiMg.WifiChannelWidth .WIDTH_80MHZ; + console.info("[wifi_test]WIDTH_80MHZ : " + JSON.stringify(WIDTH_80MHZ)); + expect(true).assertEqual( WIDTH_80MHZ == 2); + let WIDTH_160MHZ = wifiMg.WifiChannelWidth .WIDTH_160MHZ; + console.info("[wifi_test]WIDTH_160MHZ : " + JSON.stringify(WIDTH_160MHZ)); + expect(true).assertEqual( WIDTH_160MHZ == 3); + let WIDTH_80MHZ_PLUS = wifiMg.WifiChannelWidth .WIDTH_80MHZ_PLUS; + console.info("[wifi_test]WIDTH_80MHZ_PLUS : " + JSON.stringify(WIDTH_80MHZ_PLUS)); + expect(true).assertEqual( WIDTH_80MHZ_PLUS == 4); + let WIDTH_INVALID = wifiMg.WifiChannelWidth .WIDTH_INVALID; + console.info("[wifi_test]WIDTH_INVALID : " + JSON.stringify(WIDTH_INVALID)); + expect(true).assertEqual( WIDTH_INVALID == 5); }) /** diff --git a/communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js b/communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js index 898c71c95d456655b415ca29db4b28c7b9d4d747..795bc3db93369830c6cf3d0a173af39491bf578c 100644 --- a/communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js +++ b/communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js @@ -16,7 +16,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import wifi from '@ohos.wifi' - import wifiext from '@ohos.wifiext' import osaccount from '@ohos.account.osAccount' import bundle from '@ohos.bundle' @@ -54,11 +53,6 @@ function resolveIP(ip) { return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); } -let PowerModel = { - SLEEPING : 0, - GENERAL : 1, - THROUGH_WALL : 2, -} export default function actsWifiEventTest() { describe('actsWifiEventTest', function() { @@ -362,6 +356,15 @@ export default function actsWifiEventTest() { console.info("SUB_Communication_WiFi_SysCaps_Test_0007 canIUse isAccessToken error: " + e); } console.info('SUB_Communication_WiFi_SysCaps_Test_0007 end'); + let SLEEPING = wifiext.PowerModel.SLEEPING; + console.info("[wifi_test]SLEEPING : " + JSON.stringify(SLEEPING)); + expect(true).assertEqual( SLEEPING == 0); + let GENERAL = wifiext.PowerModel.GENERAL; + console.info("[wifi_test]GENERAL : " + JSON.stringify(GENERAL)); + expect(true).assertEqual( GENERAL == 1); + let THROUGH = wifiext.PowerModel.THROUGH_WALL; + console.info("[wifi_test]THROUGH : " + JSON.stringify(THROUGH)); + expect(true).assertEqual( THROUGH == 2); done(); }) console.log("*************[wifi_test] start wifi js unit test end*************"); diff --git a/location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js b/location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js index 02b831d297655e35a45c9c177d8b0e57983a650c..659b4ab245e54d4700b6a02aa486b280dd884f75 100644 --- a/location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js +++ b/location/geolocation_standard/src/main/js/test/GeocoderMTest.test.js @@ -45,7 +45,7 @@ async function changedLocationMode(){ console.info('[lbs_js] getLocationSwitchState result: ' + JSON.stringify(result1)); if(!result1){ await geolocation.requestEnableLocation().then(async(result) => { - await sleep(3000); + await sleep(1000); console.info('[lbs_js] test requestEnableLocation promise result: ' + JSON.stringify(result)); }).catch((error) => { console.info("[lbs_js] promise then error." + JSON.stringify(error)); @@ -116,11 +116,12 @@ export default function geolocationTest_geo5() { expect(true).assertEqual(JSON.stringify(geocoder1) != null); } catch (error) { console.info('[lbs_js] isGeocoderAvailable err:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } }); - /** + /** * @tc.number SUB_HSS_LocationSystem_Geo_2000 * @tc.name TestgetAddressesFromLocation * @tc.desc Address Resolution Test. @@ -130,11 +131,12 @@ export default function geolocationTest_geo5() { */ it('SUB_HSS_LocationSystem_Geo_2000', 0, async function (done) { try { - let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 1, "locale": "zh" }; + let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 1 }; geolocationm.getAddressesFromLocation(reverseGeocodeRequest, (err, data) => { if (err) { console.info('[lbs_js] getAddressesFromLocation4 callback err is:' + JSON.stringify(err)); - return; + console.info('[lbs_js] not support now'); + expect(err.code).assertEqual(801); } else { console.info("[lbs_js] getAddressesFromLocation4 callback data is:" + JSON.stringify(data)); expect(true).assertEqual((JSON.stringify(data)) != null); @@ -142,12 +144,13 @@ export default function geolocationTest_geo5() { }); } catch (error) { console.info("[lbs_js] getAddressesFromLocation4 callback try error:"+ error); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } await sleep(2000); done(); }) + /** * @tc.number SUB_HSS_LocationSystem_Geo_2100 * @tc.name TestgetAddressesFromLocation @@ -158,7 +161,7 @@ export default function geolocationTest_geo5() { */ it('SUB_HSS_LocationSystem_Geo_2100', 0, async function (done) { try { - let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 1 }; + let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 5}; await geolocationm.getAddressesFromLocation(reverseGeocodeRequest).then((data) => { console.info('[lbs_js] getAddressesFromLocation21 promise: ' + JSON.stringify(data)); console.info('addressUrl: ' + JSON.stringify(data)[0].addressUrl @@ -175,12 +178,13 @@ export default function geolocationTest_geo5() { }).catch(error => { console.info("[lbs_js] getAddressesFromLocation21 promise then error." + JSON.stringify(error)); console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); } catch (error) { console.info("[lbs_js] getAddressesFromLocation21 try err." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -201,12 +205,13 @@ export default function geolocationTest_geo5() { }).catch((error) => { console.info("[lbs_js] getAddressesFromLocation22 promise then error." + JSON.stringify(error)); console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); } catch (error) { console.info("[lbs_js] getAddressesFromLocation22 try err." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -226,12 +231,12 @@ export default function geolocationTest_geo5() { expect(true).assertEqual((JSON.stringify(data)) != null); }).catch(error => { console.info("[lbs_js] getAddressesFromLocation2301 promise then error." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); console.info('[lbs_js] not support now'); + expect(error.code).assertEqual(801); }); } catch (error) { - console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error)); + expect(true).assertFalse(); } let reverseGeocodeRequest2 = { "latitude": 90.1, "longitude": 121.62771, "maxItems": 1 }; try { @@ -240,11 +245,11 @@ export default function geolocationTest_geo5() { expect(data.length).assertEqual(0); }).catch(error => { console.info("[lbs_js] getAddressesFromLocation2302 promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); + expect(true).assertFalse(); }); } catch (error) { - console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error)); + expect(error.code).assertEqual("401"); } let reverseGeocodeRequest3 = { "latitude": -90, "longitude": 121.62771, "maxItems": 1 }; try { @@ -254,25 +259,26 @@ export default function geolocationTest_geo5() { }).catch(error => { console.info("[lbs_js] getAddressesFromLocation2303 promise then error." + JSON.stringify(error)); console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); } catch (error) { - console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error)); + expect(true).assertFalse(); } let reverseGeocodeRequest4 = { "latitude": -90.1, "longitude": 121.62771, "maxItems": 1 }; try { await geolocationm.getAddressesFromLocation(reverseGeocodeRequest4).then((data) => { console.info('[lbs_js] getAddressesFromLocation2304 promise: ' + JSON.stringify(data)); - expect(data.length).assertEqual(0); + expect(true).assertEqual((JSON.stringify(data)) != null); }).catch(error => { console.info("[lbs_js] getAddressesFromLocation2304 promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); + expect(true).assertFalse(); }); } catch (error) { - console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error)); + expect(error.code).assertEqual("401"); } + await sleep(1000); done(); }) @@ -293,12 +299,13 @@ export default function geolocationTest_geo5() { }).catch(error => { console.info("[lbs_js] getAddressesFromLocation2401 promise then error." + JSON.stringify(error)); console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); } catch (error) { - console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error)); + expect(true).assertFalse(); } + await sleep(1000); let reverseGeocodeRequest1 = { "latitude": 31.265496, "longitude": -180.1, "maxItems": 1 }; try { await geolocationm.getAddressesFromLocation(reverseGeocodeRequest1).then((data) => { @@ -306,12 +313,13 @@ export default function geolocationTest_geo5() { expect(data.length).assertEqual(0); }).catch(error => { console.info("[lbs_js] getAddressesFromLocation2402 promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); + expect(true).assertFalse(); }); } catch (error) { - console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); + console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error)); expect(true).assertEqual((JSON.stringify(error.message)) != null); } + await sleep(1000); let reverseGeocodeRequest2 = { "latitude": 31.265496, "longitude": 180, "maxItems": 1 }; try { await geolocationm.getAddressesFromLocation(reverseGeocodeRequest2).then((data) => { @@ -320,12 +328,13 @@ export default function geolocationTest_geo5() { }).catch(error => { console.info("[lbs_js] getAddressesFromLocation2403 promise then error." + JSON.stringify(error)); console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); } catch (error) { - console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error)); + expect(true).assertFalse(); } + await sleep(1000); let reverseGeocodeRequest3 = { "latitude": 31.265496, "longitude": 180.1, "maxItems": 1 }; try { await geolocationm.getAddressesFromLocation(reverseGeocodeRequest3).then((data) => { @@ -333,12 +342,13 @@ export default function geolocationTest_geo5() { expect(data.length).assertEqual(0); }).catch(error => { console.info("[lbs_js] getAddressesFromLocation2404 promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); + expect(true).assertFalse(); }); } catch (error) { - console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error.message)); + console.info("[lbs_js] getAddressesFromLocation message." + JSON.stringify(error)); expect(true).assertEqual((JSON.stringify(error.message)) != null); } + await sleep(1000); done(); }) @@ -356,10 +366,6 @@ export default function geolocationTest_geo5() { "description": "上海市浦东新区金穗路1800号", "maxItems": 1, "locale": "zh", - "minLatitude": "", - "minLongitude": "", - "maxLatitude": "", - "maxLongitude": "" }; try { geolocationm.getAddressesFromLocationName(geocodeRequest, (err, data) => { @@ -397,14 +403,14 @@ export default function geolocationTest_geo5() { } } else { console.info("[lbs_js] getAddressesFromLocationName08 callback data is: " + JSON.stringify(data)); - expect(true).assertEqual((JSON.stringify(data)) != null); } done(); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName08 message." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -417,19 +423,21 @@ export default function geolocationTest_geo5() { * @tc.level Level 2 */ it('SUB_HSS_LocationSystem_Geo_2600', 0, async function (done) { - let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 1 }; + let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 3 }; try { await geolocationm.getAddressesFromLocationName(geocodeRequest).then((result) => { console.info("[lbs_js] getAddressesFromLocation09 callback data is:" + JSON.stringify(result)); expect(true).assertEqual((JSON.stringify(result)) != null); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName09 promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual(801); }); } catch (error) { console.info("[lbs_js] getAddressesFromLocationName26 try err." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -450,12 +458,13 @@ export default function geolocationTest_geo5() { }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName10 promise then error." + JSON.stringify(error)); console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); } catch (error) { console.info("[lbs_js] getAddressesFromLocationName27 try err." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -466,6 +475,7 @@ export default function geolocationTest_geo5() { * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 + 需要实测!!!! */ it('SUB_HSS_LocationSystem_Geo_2800', 0, async function (done) { try { @@ -475,13 +485,13 @@ export default function geolocationTest_geo5() { expect(true).assertEqual((JSON.stringify(result)) != null); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName111 promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName111 message." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } + await sleep(1000); let geocodeRequest1 = { "description": null, "maxItems": 1 }; try { await geolocationm.getAddressesFromLocationName(geocodeRequest1).then((result) => { @@ -489,12 +499,13 @@ export default function geolocationTest_geo5() { expect(result.length == 0).assertTrue(); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName112 promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); + expect(true).assertFalse(); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName112 message." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } + await sleep(1000); done(); }) @@ -522,12 +533,13 @@ export default function geolocationTest_geo5() { }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName29 promise then error." + JSON.stringify(error)); console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); } catch (error) { console.info("[lbs_js] getAddressesFromLocationName29 try err." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -555,12 +567,13 @@ export default function geolocationTest_geo5() { expect(result.length == 0).assertTrue(); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName301 promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); + expect(true).assertFalse(); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName301 message." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } + await sleep(1000); let geocodeRequest1 = { "description": null, "maxItems": 1, @@ -575,12 +588,14 @@ export default function geolocationTest_geo5() { expect(result.length == 0).assertTrue(); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName302 promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); + expect(true).assertFalse(); + }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName302 message." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } + await sleep(1000); done(); }) @@ -608,13 +623,13 @@ export default function geolocationTest_geo5() { expect(result.length >= 0).assertTrue(); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName31 promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); } catch (error) { console.info("[lbs_js] getAddressesFromLocationName31 message." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } + await sleep(1000); done(); }) @@ -643,12 +658,13 @@ export default function geolocationTest_geo5() { }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName32 promise then error." + JSON.stringify(error)); console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); } catch (error) { console.info("[lbs_js] getAddressesFromLocationName32 message." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } + await sleep(1000); done(); }) @@ -676,12 +692,13 @@ export default function geolocationTest_geo5() { }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName33 promise1 then error." + JSON.stringify(error)); console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName33 message1." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } + await sleep(1000); let geocodeRequest2 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -697,12 +714,13 @@ export default function geolocationTest_geo5() { }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName33 promise2 then error." + JSON.stringify(error)); console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName33 message2." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } + await sleep(1000); let geocodeRequest3 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -717,12 +735,13 @@ export default function geolocationTest_geo5() { expect(true).assertEqual((JSON.stringify(result)) == null); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName33 promise3 then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); + expect(true).assertFalse(); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName33 message3." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } + await sleep(1000); let geocodeRequest4 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -738,12 +757,13 @@ export default function geolocationTest_geo5() { expect(true).assertEqual(JSON.stringify(error) != null); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName33 promise4 then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); + expect(true).assertFalse(); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName33 message4." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } + await sleep(1000); let geocodeRequest5 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -759,12 +779,13 @@ export default function geolocationTest_geo5() { }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName33 promise5 then error." + JSON.stringify(error)); console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName33 message5." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } + await sleep(1000); let geocodeRequest6 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -780,12 +801,13 @@ export default function geolocationTest_geo5() { }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName33 promise6 then error." + JSON.stringify(error)); console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName33 message6." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } + await sleep(1000); let geocodeRequest7 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -800,12 +822,13 @@ export default function geolocationTest_geo5() { expect(true).assertEqual((JSON.stringify(result)) == null); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName33 promise7 then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); + expect(true).assertFalse(); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName33 message7." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } + await sleep(1000); let geocodeRequest8 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -820,12 +843,13 @@ export default function geolocationTest_geo5() { expect(true).assertEqual((JSON.stringify(result)) == null); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName33 promise8 then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); + expect(true).assertFalse(); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName33 message8." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } + await sleep(1000); done(); }) @@ -853,12 +877,13 @@ export default function geolocationTest_geo5() { }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName34 promise1 then error." + JSON.stringify(error)); console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(801); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName34 message1." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } + await sleep(1000); let geocodeRequest2 = { "description": "北京天安门", "maxItems": 1, @@ -873,12 +898,14 @@ export default function geolocationTest_geo5() { expect(true).assertEqual((JSON.stringify(result)) != null); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName34 promise2 then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual(801); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName34 message2." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } + await sleep(1000); let geocodeRequest3 = { "description": "北京天安门", "maxItems": 1, @@ -893,12 +920,13 @@ export default function geolocationTest_geo5() { expect(true).assertEqual((JSON.stringify(result)) != null); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName34 promise3 then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); + expect(true).assertFalse(); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName34 message3." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } + await sleep(1000); let geocodeRequest4 = { "description": "北京天安门", "maxItems": 1, @@ -913,12 +941,13 @@ export default function geolocationTest_geo5() { expect(true).assertEqual((JSON.stringify(result)) != null); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName34 promise4 then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); + expect(true).assertFalse(); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName34 message4." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } + await sleep(1000); let geocodeRequest5 = { "description": "北京天安门", "maxItems": 1, @@ -933,11 +962,12 @@ export default function geolocationTest_geo5() { expect(true).assertEqual((JSON.stringify(result)) != null); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName34 promise5 then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual(801); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName34 message5." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } let geocodeRequest6 = { "description": "北京天安门", @@ -953,12 +983,14 @@ export default function geolocationTest_geo5() { expect(true).assertEqual((JSON.stringify(result)) != null); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName34 promise6 then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual(801); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName34 message6." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(true).assertFalse(); } + await sleep(1000); let geocodeRequest7 = { "description": "北京天安门", "maxItems": 1, @@ -973,11 +1005,11 @@ export default function geolocationTest_geo5() { expect(true).assertEqual((JSON.stringify(result)) != null); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName34 promise7 then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); + expect(true).assertFalse(); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName34 message7." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } let geocodeRequest8 = { "description": "北京天安门", @@ -993,15 +1025,18 @@ export default function geolocationTest_geo5() { expect(true).assertEqual((JSON.stringify(result)) != null); }).catch((error) => { console.info("[lbs_js] getAddressesFromLocationName34 promise8 then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); + expect(true).assertFalse(); }); }catch(error){ console.info("[lbs_js] getAddressesFromLocationName34 message8." + JSON.stringify(error.message)); - expect(true).assertEqual((JSON.stringify(error.message)) != null); + expect(error.code).assertEqual("401"); } + await sleep(1000); done(); }) + + }) } diff --git a/location/geolocation_standard/src/main/js/test/GetCountryCodeM.test.js b/location/geolocation_standard/src/main/js/test/GetCountryCodeM.test.js index 90f1e7f514f885cf92d1f12becf1d16312911c42..e2b9ea3e5d71cbe3022a69a1bd335004923e9cc6 100644 --- a/location/geolocation_standard/src/main/js/test/GetCountryCodeM.test.js +++ b/location/geolocation_standard/src/main/js/test/GetCountryCodeM.test.js @@ -30,7 +30,7 @@ async function changedLocationMode(){ console.info('[lbs_js] getLocationSwitchState result: ' + JSON.stringify(result1)); if(!result1){ await geolocation.requestEnableLocation().then(async(result) => { - await sleep(3000); + await sleep(1000); console.info('[lbs_js] test requestEnableLocation promise result: ' + JSON.stringify(result)); }).catch((error) => { console.info("[lbs_js] promise then error." + JSON.stringify(error)); @@ -130,6 +130,7 @@ export default function geolocationTest_6() { geolocationm.getCountryCode((err,data) => { if (err) { return console.info("[lbs_js] getCountryCode callback err: " + JSON.stringify(err)); + expect().assertFail(); } else { console.info("[lbs_js] getCountryCode callback success"+ JSON.stringify(data)); expect(true).assertEqual(data != null); @@ -158,7 +159,7 @@ export default function geolocationTest_6() { }); } catch (error) { console.info("[lbs_js] countryCodeChangeOn try err." + JSON.stringify(error)); - expect(true).assertEqual(error != null); + expect().assertFail(); } try { await geolocationm.getCountryCode().then((result) => { @@ -178,7 +179,7 @@ export default function geolocationTest_6() { }) } catch (error) { console.info("[lbs_js] countryCodeChangeOn try err." + JSON.stringify(error)); - expect(true).assertEqual(error != null); + expect().assertFail(); } done(); }) diff --git a/location/geolocation_standard/src/main/js/test/LocationMTest.test.js b/location/geolocation_standard/src/main/js/test/LocationMTest.test.js index e52806a2e08e398d0da3aa27b88716b1bfe0fbf9..0e16a6a423ca48b16aca25d889a6ce9175f962b2 100644 --- a/location/geolocation_standard/src/main/js/test/LocationMTest.test.js +++ b/location/geolocation_standard/src/main/js/test/LocationMTest.test.js @@ -39,7 +39,7 @@ async function changedLocationMode(){ console.info('[lbs_js] getLocationSwitchState result: ' + JSON.stringify(result1)); if(!result1){ await geolocation.requestEnableLocation().then(async(result) => { - await sleep(3000); + ; console.info('[lbs_js] test requestEnableLocation promise result: ' + JSON.stringify(result)); }).catch((error) => { console.info("[lbs_js] promise then error." + JSON.stringify(error)); @@ -80,6 +80,7 @@ async function applyPermission() { console.info('[permission] case accessTokenID is ' + tokenID); let permissionName1 = 'ohos.permission.LOCATION'; let permissionName2 = 'ohos.permission.LOCATION_IN_BACKGROUND'; + let permissionName3 = 'ohos.permission.APPROXIMATELY_LOCATION'; await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { console.info('[permission] case grantUserGrantedPermission success :' + JSON.stringify(result)); }).catch((err) => { @@ -90,6 +91,11 @@ async function applyPermission() { }).catch((err) => { console.info('[permission] case grantUserGrantedPermission failed :' + JSON.stringify(err)); }); + await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + JSON.stringify(result)); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + JSON.stringify(err)); + }); } else { console.info('[permission] case apply permission failed, createAtManager failed'); } @@ -113,6 +119,7 @@ export default function geolocationTest_geo7() { }) + /** * @tc.number SUB_HSS_LocationSystem_LocSwitch_0600 * @tc.name Test requestrequestEnableLocation api @@ -124,8 +131,8 @@ export default function geolocationTest_geo7() { it('SUB_HSS_LocationSystem_LocSwitch_0600', 0, function () { try { let state = geolocationm.isLocationEnabled(); - console.info('[lbs_js] getLocationSwitchState06 result: ' + JSON.stringify(state)); - expect(true).assertEqual(JSON.stringify(state) != null); + console.info('[lbs_js] getLocationSwitchState06 result: ' + JSON.stringify(state)); + expect(true).assertEqual(state); } catch (error) { console.info("[lbs_js] getLocationSwitchState06 try err." + JSON.stringify(error)); expect().assertFail(); @@ -147,15 +154,16 @@ export default function geolocationTest_geo7() { } try { geolocationm.on('locationEnabledChange', locationServiceState); + } catch (error) { console.info("[lbs_js] locationServiceStateOn07 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect().assertFail(); } try { geolocationm.off('locationEnabledChange', locationServiceState); } catch (error) { console.info("[lbs_js] locationServiceStateOff07 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect().assertFail(); } done(); }) @@ -174,7 +182,7 @@ export default function geolocationTest_geo7() { geolocationm.getCurrentLocation(currentLocationRequest, (err, result) => { if (err) { console.info("[lbs_js] getCurrentLocation15 callback err: " + JSON.stringify(err)); - expect(true).assertEqual(err != null); + expect(err.code).assertEqual(3301200); console.info('[lbs_js] getCurrentLocationCallback reject after'); done(); } else { @@ -184,9 +192,9 @@ export default function geolocationTest_geo7() { }); } catch (error) { console.info("[lbs_js] getCurrentLocation15 callback try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } - await sleep(1500); + await sleep(1000); done(); }) @@ -205,12 +213,13 @@ export default function geolocationTest_geo7() { console.info('[lbs_js] getCurrentLocation16 promise result ' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation16 promise err:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation16 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -230,12 +239,13 @@ export default function geolocationTest_geo7() { expect(true).assertEqual(result != null); }).catch(error => { console.info('[lbs_js] getCurrentLocation callback17:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation callback17 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -254,12 +264,13 @@ export default function geolocationTest_geo7() { console.info('[lbs_js] getCurrentLocation18 promise result ' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation18 promise err:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation18 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -278,12 +289,13 @@ export default function geolocationTest_geo7() { console.info('[lbs_js] getCurrentLocation19 promise result:' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation19 promise err:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation18 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -300,27 +312,29 @@ export default function geolocationTest_geo7() { let currentLocationRequest1 = { "priority": 0x200, "scenario": 0x305, "timeoutMs": 1000, "maxAccuracy": 10 }; let currentLocationRequest2 = { "priority": 0x200, "scenario": 0x301, "timeoutMs": 1000, "maxAccuracy": 10 }; try { - await geolocationm.getCurrentLocation(currentLocationRequest).then((result) => { + await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => { console.info('[lbs_js] getCurrentLocation1901 promise result:' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation1901 promise err:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation1901 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); try { await geolocationm.getCurrentLocation(currentLocationRequest2).then((result) => { console.info('[lbs_js] getCurrentLocation1902 promise result:' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation1902 promise err:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation1902 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -339,12 +353,13 @@ export default function geolocationTest_geo7() { console.info('[lbs_js] getCurrentLocation21 promise result ' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation21 promise err:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation21 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -363,12 +378,13 @@ export default function geolocationTest_geo7() { console.info('[lbs_js] getCurrentLocation22 promise result:' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation22 promise err:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation22 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -387,12 +403,13 @@ export default function geolocationTest_geo7() { console.info('[lbs_js] getCurrentLocation promise result23:' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation promise err23:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation23 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -412,23 +429,25 @@ export default function geolocationTest_geo7() { console.info('[lbs_js] getCurrentLocation promise result241 ' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation promise err241:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation241 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); try { await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => { console.info('[lbs_js] getCurrentLocation promise result242 ' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation promise err242:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation242 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -449,23 +468,25 @@ export default function geolocationTest_geo7() { console.info('[lbs_js] getCurrentLocation promise result251 ' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation promise err251:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation251 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); try { await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => { console.info('[lbs_js] getCurrentLocation promise result252 ' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation promise err252:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation252 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -485,23 +506,25 @@ export default function geolocationTest_geo7() { console.info('[lbs_js] getCurrentLocation promise result261 ' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation promise err261:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation261 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); try { await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => { console.info('[lbs_js] getCurrentLocation promise result262 ' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation promise err262:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation262 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -521,23 +544,25 @@ export default function geolocationTest_geo7() { console.info('[lbs_js] getCurrentLocation promise result271 ' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation promise err271:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }); } catch (error) { console.info("[lbs_js] getCurrentLocation271 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); try { await geolocationm.getCurrentLocation(currentLocationRequest1).then((result) => { console.info('[lbs_js] getCurrentLocation promise result272 ' + JSON.stringify(result)); }).catch(error => { console.info('[lbs_js] getCurrentLocation promise err272:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual(3301200); }) } catch (error) { console.info("[lbs_js] getCurrentLocation272 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -550,20 +575,22 @@ export default function geolocationTest_geo7() { * @tc.level Level 2 */ it('SUB_HSS_SendCommand_0300', 0, async function (done) { - let requestInfo = { 'scenairo': 0x301, 'command': "command_1" }; + let requestInfo = { 'scenario': 0x301, 'command': "command_1" }; try { await geolocationm.sendCommand(requestInfo, (err, result) => { if (err) { console.info('sendcommand callback err:' + JSON.stringify(err)); - expect(true).assertEqual(JSON.stringify(err) != null); + console.info('sendcommand not support'); + expect(err.code).assertEqual(801); done(); } console.info('sendcommand callback result:' + JSON.stringify(result)); }); } catch (error) { console.info('sendcommand callback err:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -576,20 +603,23 @@ export default function geolocationTest_geo7() { * @tc.level Level 2 */ it('SUB_HSS_SendCommand_0400', 0, async function (done) { - let requestInfo = { 'scenairo': 0x301, 'command': "command_1" }; + let requestInfo = { 'scenario': 0x301, 'command': "command_1" }; try { geolocationm.sendCommand(requestInfo).then((result) => { - console.info('sendCommand promise result:' + result); + console.info('[lbs_js] sendCommand promise result:' + result); done(); }).catch(error => { - console.info('sendcommand promise err:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] sendcommand promise err:' + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual(801); + //expect(true).assertEqual(JSON.stringify(error) != null); done(); }) } catch (error) { - console.info('sendcommand promise err:' + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] sendcommand promise err:' + JSON.stringify(error)); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -613,14 +643,15 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo, locationChange); } catch (error) { console.info("[lbs_js] locationChangerOn16 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange); } catch (error) { console.info("[lbs_js] locationChangerOff16 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -644,14 +675,15 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo, locationChange); } catch (error) { console.info("[lbs_js] locationChangerOn17 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange); } catch (error) { console.info("[lbs_js] locationChangerOff17 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -675,14 +707,15 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo, locationChange); } catch (error) { console.info("[lbs_js] locationChangerOn18 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange); } catch (error) { console.info("[lbs_js] locationChangerOff18 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -706,14 +739,15 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo, locationChange); } catch (error) { console.info("[lbs_js] locationChangerOn19 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange); } catch (error) { console.info("[lbs_js] locationChangerOff19 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -742,26 +776,27 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo, locationChange1); } catch (error) { console.info("[lbs_js] locationChangerOn201 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.on('locationChange', requestInfo, locationChange2); } catch (error) { console.info("[lbs_js] locationChangerOn202 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange1); } catch (error) { console.info("[lbs_js] locationChangerOff201 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange2); } catch (error) { console.info("[lbs_js] locationChangerOff202 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -786,14 +821,15 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo, locationChange); } catch (error) { console.info("[lbs_js] locationChangerOn21 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange); } catch (error) { console.info("[lbs_js] locationChangerOff21 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -818,14 +854,15 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo, locationChange); } catch (error) { console.info("[lbs_js] locationChangerOn22 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange); } catch (error) { console.info("[lbs_js] locationChangerOff22 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -850,14 +887,15 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo, locationChange); } catch (error) { console.info("[lbs_js] locationChangerOn23 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange); } catch (error) { console.info("[lbs_js] locationChangerOff23 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -881,14 +919,15 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo, locationChange); } catch (error) { console.info("[lbs_js] locationChangerOn24 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange); } catch (error) { console.info("[lbs_js] locationChangerOff24 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -912,14 +951,15 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo, locationChange); } catch (error) { console.info("[lbs_js] locationChangerOn25 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange); } catch (error) { console.info("[lbs_js] locationChangerOff25 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -943,14 +983,15 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo, locationChange); } catch (error) { console.info("[lbs_js] locationChangerOn26 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange); } catch (error) { console.info("[lbs_js] locationChangerOff26 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -980,26 +1021,28 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo1, locationChange1); } catch (error) { console.info("[lbs_js] locationChangerOn271 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange1); } catch (error) { console.info("[lbs_js] locationChangerOff271 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); try { geolocationm.on('locationChange', requestInfo2, locationChange2); } catch (error) { console.info("[lbs_js] locationChangerOn272 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange2); } catch (error) { console.info("[lbs_js] locationChangerOff272 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -1029,26 +1072,28 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo1, locationChange1); } catch (error) { console.info("[lbs_js] locationChangerOn281 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange1); } catch (error) { console.info("[lbs_js] locationChangerOff281 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); try { geolocationm.on('locationChange', requestInfo2, locationChange2); } catch (error) { console.info("[lbs_js] locationChangerOn282 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange2); } catch (error) { console.info("[lbs_js] locationChangerOff282 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -1078,26 +1123,28 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo1, locationChange1); } catch (error) { console.info("[lbs_js] locationChangerOn291 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange1); } catch (error) { console.info("[lbs_js] locationChangerOff291 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); try { geolocationm.on('locationChange', requestInfo2, locationChange2); } catch (error) { console.info("[lbs_js] locationChangerOn292 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange2); } catch (error) { console.info("[lbs_js] locationChangerOff292 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -1121,26 +1168,30 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo, locationChange); } catch (error) { console.info("[lbs_js] locationChangerOn03 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange); } catch (error) { console.info("[lbs_js] locationChangerOff03 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); try { - let last =geolocationm.getLastLocation(); - console.info('[lbs_js] getLastLocation latitude: ' + result.latitude + + let last =geolocationm.getLastLocation(); + console.info('[lbs_js] getLastLocation latitude: ' + last.latitude + ' longitude: ' + result.longitude +' altitude: ' + result.altitude +' accuracy: ' + result.accuracy+' speed: ' + result.speed + 'timeStamp: ' + result.timeStamp+'direction:' + result.direction+' timeSinceBoot: ' + result.timeSinceBoot +'additions: ' + result.additions+' additionSize' + result.additionSize + 'isFromMock' +result.isFromMock); + expect(true).assertEqual(JSON.stringify(last) != null); } catch (error) { console.info("[lbs_js] getLastLocation error:"+ error) + expect(error.code).assertEqual("3301200"); } + await sleep(1500); done(); }) @@ -1166,7 +1217,7 @@ export default function geolocationTest_geo7() { geolocationm.on('satelliteStatusChange', gnssStatusCb); } catch (error) { console.info("[lbs_js] satelliteStatusOn03 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":0, @@ -1179,20 +1230,21 @@ export default function geolocationTest_geo7() { geolocationm.on('locationChange', requestInfo, locationChange); } catch (error) { console.info("[lbs_js] locationChangerOn03 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('satelliteStatusChange', gnssStatusCb); } catch (error) { console.info("[lbs_js] satelliteStatusOff03 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange); } catch (error) { console.info("[lbs_js] locationChangerOff03 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -1219,8 +1271,7 @@ export default function geolocationTest_geo7() { geolocationm.on('nmeaMessage', nmeaCb); } catch (error) { console.info("nmea on err:" + JSON.stringify(error)); - expect(true).assertEqual(error !=null); - done(); + expect(true).assertFalse(); } try { geolocationm.on('locationChange', requestInfo, locationChange); @@ -1232,14 +1283,15 @@ export default function geolocationTest_geo7() { geolocationm.off('nmeaMessage', nmeaCb); } catch (error) { console.info("nmea off err:" + JSON.stringify(error)); - expect(true).assertEqual(error !=null); + expect(true).assertFalse(); } try { geolocationm.off('locationChange', locationChange); } catch (error) { console.info("[lbs_js] locationChangerOff03 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -1261,14 +1313,16 @@ export default function geolocationTest_geo7() { geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest1, cachedLocationsCb1); } catch (error) { console.info("[lbs_js] cachedGnssLocOn071 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(error.code).assertEqual("801"); } try { geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb1); } catch (error) { console.info("[lbs_js] cachedGnssLocOff071 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } + await sleep(1500); var cachedLocationsCb2 = (locations) => { console.log('[lbs_js] cachedGnssLocationsReporting7:locations:' + JSON.stringify(locations)); expect(true).assertEqual(locations !=null); @@ -1278,14 +1332,17 @@ export default function geolocationTest_geo7() { geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest2, cachedLocationsCb2); } catch (error) { console.info("[lbs_js] cachedGnssLocOn072 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } try { geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb1); } catch (error) { console.info("[lbs_js] cachedGnssLocOff072 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } + await sleep(1500); done(); }) @@ -1307,14 +1364,17 @@ export default function geolocationTest_geo7() { geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb); } catch (error) { console.info("[lbs_js] cachedGnssLocOn08 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } try { geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb); } catch (error) { console.info("[lbs_js] cachedGnssLocOff08 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } + await sleep(1500); done(); }) @@ -1336,19 +1396,23 @@ export default function geolocationTest_geo7() { geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb); } catch (error) { console.info("[lbs_js] cachedGnssLocOn09 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } try { geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb); } catch (error) { console.info("[lbs_js] cachedGnssLocOff09 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } + await sleep(1500); try { geolocationm.getCachedGnssLocationsSize((err, data) => { if (err) { console.info('[lbs_js] getCachedGnssLocationsSize09 callback err:' + JSON.stringify(err)); - expect(true).assertEqual(err != null); + console.info('[lbs_js] not support now'); + expect(err.code).assertEqual(801); }else { console.info("[lbs_js] getCachedGnssLocationsSize09 callback data:" + JSON.stringify(data)); expect(true).assertEqual(data != null); @@ -1356,7 +1420,8 @@ export default function geolocationTest_geo7() { }); } catch (error) { console.info("[lbs_js] getCachedGnssLocationsSize09 callback try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); + } await sleep(1000); done(); @@ -1380,26 +1445,31 @@ export default function geolocationTest_geo7() { geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb); } catch (error) { console.info("[lbs_js] cachedGnssLocOn10 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } try { geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb); } catch (error) { console.info("[lbs_js] cachedGnssLocOff10 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } + await sleep(1000); try { await geolocationm.getCachedGnssLocationsSize().then( (result) => { console.info('[lbs_js] getCachedGnssLocationsSiz promise '+ JSON.stringify(result)); expect(true).assertEqual(result != null); }).catch((error) => { console.info("[lbs_js] promise then error." + JSON.stringify(error)); - expect(true).assertEqual(error != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual(801); }); } catch (error) { console.info("[lbs_js] getCachedGnssLocationsSize promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1500); done(); }) @@ -1421,19 +1491,23 @@ export default function geolocationTest_geo7() { geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb); } catch (error) { console.info("[lbs_js] cachedGnssLocOn11 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } try { geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb); } catch (error) { console.info("[lbs_js] cachedGnssLocOff11 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } + await sleep(1000); try { geolocationm.flushCachedGnssLocations((err, data) => { if (err) { console.info('[lbs_js] flushCachedGnssLocations11 callback err is : ' + JSON.stringify(err)); - expect(true).assertEqual(err != null); + console.info('[lbs_js] not support now'); + expect(err.code).assertEqual(801); }else { console.info("[lbs_js] flushCachedGnssLocations11 callback data is: " + JSON.stringify(data)); expect(true).assertEqual(data != null); @@ -1441,7 +1515,7 @@ export default function geolocationTest_geo7() { }); } catch (error) { console.info("[lbs_js] flushCachedGnssLocations11 callback try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } await sleep(1000); done(); @@ -1465,25 +1539,31 @@ export default function geolocationTest_geo7() { geolocationm.on('cachedGnssLocationsChange', CachedGnssLoactionsRequest, cachedLocationsCb); } catch (error) { console.info("[lbs_js] cachedGnssLocOn11 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } try { geolocationm.off('cachedGnssLocationsChange',cachedLocationsCb); } catch (error) { console.info("[lbs_js] cachedGnssLocOff11 try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } + await sleep(1000); try { await geolocationm.flushCachedGnssLocations().then( (result) => { console.info('[lbs_js] flushCachedGnssLocations promise '+ JSON.stringify(result)); expect(true).assertEqual(result != null); }).catch((error) => { console.info("[lbs_js] promise then error." + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual(801); }); } catch (error) { console.info("[lbs_js] flushCachedGnssLocations11 promise try err." + JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + expect(true).assertFalse(); } + await sleep(1000); done(); }) @@ -1510,7 +1590,8 @@ export default function geolocationTest_geo7() { }); } catch (error) { console.info("[lbs_js] FenceStatusOn2 try error:"+ JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } try { geolocationm.off('gnssFenceStatusChange',geofenceRequest, @@ -1523,7 +1604,8 @@ export default function geolocationTest_geo7() { }); } catch (error) { console.info("[lbs_js] FenceStatusOff2 try error:"+ JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } await sleep(1000); done(); @@ -1546,13 +1628,16 @@ export default function geolocationTest_geo7() { (want) => { if(err){ return console.info("[lbs_js] fenceStatusChange3 on callback err: " + err); + console.info("[lbs_js] fenceStatusChange not support "); + expect(err.code).assertEqual(801); } console.info("[lbs_js] fenceStatusChange3 callback result: " + JSON.stringify(want)); expect(true).assertEqual(want !=null); }); } catch (error) { console.info("[lbs_js] FenceStatusOn3 try error:"+ JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } try { geolocationm.off('gnssFenceStatusChange',geofenceRequest, @@ -1565,7 +1650,8 @@ export default function geolocationTest_geo7() { }); } catch (error) { console.info("[lbs_js] FenceStatusOff3 try error:"+ JSON.stringify(error)); - expect(true).assertEqual(JSON.stringify(error) != null); + console.info('[lbs_js] not support now'); + expect(error.code).assertEqual("801"); } await sleep(1000); done();