diff --git a/location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js b/location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js index 236f19a2e99cf9c41383425b7c61753a17d999e9..47537eb0c7d5759a3040f3b821da6a7bfb3d5784 100644 --- a/location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js +++ b/location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js @@ -101,14 +101,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0001 + * @tc.number SUB_HSS_LocationSystem_Geo_0100 * @tc.name testIsGeoServiceAvailable * @tc.desc Check whether address resolution and reverse address resolution are supported. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0100', 0, async function (done) { geolocation.isGeoServiceAvailable(async (err, data) => { if (err) { console.info('[lbs_js] getGeoServiceState err is : ' + JSON.stringify(err)); @@ -124,14 +124,14 @@ describe('geolocationTest_geo1', function () { }); /** - * @tc.number SUB_HSS_LocationSystem_Geo_0002 + * @tc.number SUB_HSS_LocationSystem_Geo_0200 * @tc.name TestisGeoServiceAvailable * @tc.desc Check whether address resolution and reverse address resolution are supported. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0200', 0, async function (done) { await geolocation.isGeoServiceAvailable().then((result) => { console.info('[lbs_js] isGeoServiceAvailable1 promise result: ' + JSON.stringify(result)); console.info('[lbs_js] not support now'); @@ -144,14 +144,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0003 + * @tc.number SUB_HSS_LocationSystem_Geo_0300 * @tc.name TestgetAddressesFromLocation * @tc.desc Address Resolution Test. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0300', 0, async function (done) { let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 1, "locale": "zh" }; let promise = new Promise((resolve, reject) => { geolocation.getAddressesFromLocation(reverseGeocodeRequest, (err, data) => { @@ -168,14 +168,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0004 + * @tc.number SUB_HSS_LocationSystem_Geo_0400 * @tc.name TestgetAddressesFromLocation * @tc.desc Address Resolution Test. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0004', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0400', 0, async function (done) { let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 1 }; await geolocation.getAddressesFromLocation(reverseGeocodeRequest).then((data) => { console.info('[lbs_js] getAddressesFromLocation04 promise: ' + JSON.stringify(data)); @@ -199,14 +199,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0005 + * @tc.number SUB_HSS_LocationSystem_Geo_0500 * @tc.name TestgetAddressesFromLocation * @tc.desc Obtaining Multiple Addresses Using the Address Resolution Function. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0005', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0500', 0, async function (done) { let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 5 }; await geolocation.getAddressesFromLocation(reverseGeocodeRequest).then((data) => { console.info('[lbs_js] getAddressesFromLocation05 promise: ' + JSON.stringify(data)); @@ -221,14 +221,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0006 + * @tc.number SUB_HSS_LocationSystem_Geo_0600 * @tc.name TestgetAddressesFromLocation * @tc.desc Input parameter boundary test of the address resolution function * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0006', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0600', 0, async function (done) { let reverseGeocodeRequest1 = { "latitude": 90, "longitude": 121.62771, "maxItems": 1 }; await geolocation.getAddressesFromLocation(reverseGeocodeRequest1).then((data) => { console.info('[lbs_js] getAddressesFromLocation0601 promise: ' + JSON.stringify(data)); @@ -267,14 +267,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0007 + * @tc.number SUB_HSS_LocationSystem_Geo_0700 * @tc.name TestgetAddressesFromLocation * @tc.desc Input parameter boundary test of the address resolution function * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0007', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0700', 0, async function (done) { let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 180, "maxItems": 1 }; await geolocation.getAddressesFromLocation(reverseGeocodeRequest).then((data) => { console.info('[lbs_js] getAddressesFromLocation0701 promise: ' + JSON.stringify(data)); @@ -313,14 +313,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0008 + * @tc.number SUB_HSS_LocationSystem_Geo_0800 * @tc.name TestgetAddressesFromLocation * @tc.desc Reverse address resolution test. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0008', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0800', 0, async function (done) { let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 1, @@ -330,56 +330,62 @@ describe('geolocationTest_geo1', function () { "maxLatitude": "", "maxLongitude": "" }; - geolocation.getAddressesFromLocationName(geocodeRequest, (err, data) => { - if (err) { - switch (err) { - case 100: - console.info("NOT_SUPPORTED: " + JSON.stringify(err)); - break; - case 101: - console.info("INPUT_PARAMS_ERROR: " + JSON.stringify(err)); - break; - case 102: - console.info("REVERSE_GEOCODE_ERROR: " + JSON.stringify(err)); - break; - case 103: - console.info("GEOCODE_ERROR: " + JSON.stringify(err)); - break; - case 104: - console.info("LOCATOR_ERROR: " + JSON.stringify(err)); - break; - case 105: - console.info("LOCATION_SWITCH_ERROR: " + JSON.stringify(err)); - break; - case 106: - console.info("LAST_KNOWN_LOCATION_ERROR: " + JSON.stringify(err)); - break; - case 107: - console.info("LOCATION_REQUEST_TIMEOUT_ERROR: " + JSON.stringify(err)); - break; - case 108: - console.info("QUERY_COUNTRY_CODE_ERROR: " + JSON.stringify(err)); - break; - default: - console.info('[lbs_js] getAddressesFromLocationName callback err is : ' + JSON.stringify(err)); + try { + geolocation.getAddressesFromLocationName(geocodeRequest, (err, data) => { + if (err) { + switch (err) { + case 100: + console.info("NOT_SUPPORTED: " + JSON.stringify(err)); + break; + case 101: + console.info("INPUT_PARAMS_ERROR: " + JSON.stringify(err)); + break; + case 102: + console.info("REVERSE_GEOCODE_ERROR: " + JSON.stringify(err)); + break; + case 103: + console.info("GEOCODE_ERROR: " + JSON.stringify(err)); + break; + case 104: + console.info("LOCATOR_ERROR: " + JSON.stringify(err)); + break; + case 105: + console.info("LOCATION_SWITCH_ERROR: " + JSON.stringify(err)); + break; + case 106: + console.info("LAST_KNOWN_LOCATION_ERROR: " + JSON.stringify(err)); + break; + case 107: + console.info("LOCATION_REQUEST_TIMEOUT_ERROR: " + JSON.stringify(err)); + break; + case 108: + console.info("QUERY_COUNTRY_CODE_ERROR: " + JSON.stringify(err)); + break; + default: + console.info('getAddressesFromLocationName callback err: ' + JSON.stringify(err)); + } + } else { + console.info("[lbs_js] getAddressesFromLocationName08 callback data is: " + JSON.stringify(data)); + expect(true).assertEqual((JSON.stringify(data)) != null); } - } else { - console.info("[lbs_js] getAddressesFromLocationName08 callback data is: " + JSON.stringify(data)); - expect(true).assertEqual((JSON.stringify(data)) != null); - } - done(); - }); + done(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } + done(); }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0009 + * @tc.number SUB_HSS_LocationSystem_Geo_0900 * @tc.name TestgetAddressesFromLocation * @tc.desc Reverse address resolution test. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0009', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0900', 0, async function (done) { let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 1 }; await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => { console.info("[lbs_js] getAddressesFromLocation callback data is: " + JSON.stringify(result)); @@ -392,14 +398,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0010 + * @tc.number SUB_HSS_LocationSystem_Geo_1000 * @tc.name TestgetAddressesFromLocation * @tc.desc Obtaining Multiple Locations Using the Reverse Address Resolution Function. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0010', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1000', 0, async function (done) { let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 5 }; await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => { console.info("[lbs_js] getAddressesFromLocation m callback data is: " + JSON.stringify(result)); @@ -413,44 +419,54 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0011 + * @tc.number SUB_HSS_LocationSystem_Geo_1100 * @tc.name TestgetAddressesFromLocation * @tc.desc Invalid parameter input test for the reverse address resolution function. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0011', 0, async function (done) { - let geocodeRequest = { "description": "", "maxItems": 1 }; - await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => { - console.info("[lbs_js] getAddressesFromLocation promise data is: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + it('SUB_HSS_LocationSystem_Geo_1100', 0, async function (done) { + try { + + let geocodeRequest = { "description": "", "maxItems": 1 }; + await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => { + console.info("[lbs_js] getAddressesFromLocation promise data is: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest1 = { "description": null, "maxItems": 1 }; - await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { - console.info("[lbs_js] getAddressesFromLocation promise data is: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + try { + await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { + console.info("[lbs_js] getAddressesFromLocation callback data is: " + JSON.stringify(result)); + expect(result.length == 0).assertTrue(); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } done(); }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0012 + * @tc.number SUB_HSS_LocationSystem_Geo_1200 * @tc.name TestgetAddressesFromLocation * @tc.desc Test the reverse address resolution function in the specified range.. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0012', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1200', 0, async function (done) { let geocodeRequest = { "description": "上海金穗路1800号", "maxItems": 1, @@ -471,7 +487,7 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0013 + * @tc.number SUB_HSS_LocationSystem_Geo_1300 * @tc.name TestgetAddressesFromLocation * @tc.desc Invalid input parameter test for the reverse address resolution function in the specified range * -Invalid location name. @@ -479,7 +495,7 @@ describe('geolocationTest_geo1', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0013', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1300', 0, async function (done) { let geocodeRequest = { "description": "", "maxItems": 1, @@ -488,13 +504,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 31.1537977881, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => { - console.info("[lbs_js] getAddressesFromLocation callback data is: " + JSON.stringify(result)); - expect(result.length == 0).assertTrue(); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); - }); + try { + await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => { + console.info("[lbs_js] getAddressesFromLocation callback data is: " + JSON.stringify(result)); + expect(result.length == 0).assertTrue(); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest1 = { "description": null, "maxItems": 1, @@ -503,18 +524,23 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 31.1537977881, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { - console.info("[lbs_js] getAddressesFromLocation callback data is: " + JSON.stringify(result)); - expect(result.length == 0).assertTrue(); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); - }); + try { + await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { + console.info("[lbs_js] getAddressesFromLocation callback data is: " + JSON.stringify(result)); + expect(result.length == 0).assertTrue(); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } done(); }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0014 + * @tc.number SUB_HSS_LocationSystem_Geo_1400 * @tc.name TestgetAddressesFromLocation * @tc.desc Invalid input parameter test for the reverse address resolution function in the specified range * - the address is not in the range. @@ -522,7 +548,7 @@ describe('geolocationTest_geo1', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0014', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1400', 0, async function (done) { let geocodeRequest = { "description": "北京天安门", "maxItems": 1, @@ -543,7 +569,7 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0015 + * @tc.number SUB_HSS_LocationSystem_Geo_1500 * @tc.name TestgetAddressesFromLocation * @tc.desc Invalid longitude and latitude entered for the reverse address resolution * function in the specified range. The longitude and latitude range boundary is inverted.. @@ -551,7 +577,7 @@ describe('geolocationTest_geo1', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0015', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1500', 0, async function (done) { let geocodeRequest = { "description": "北京天安门", "maxItems": 1, @@ -572,14 +598,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0016 + * @tc.number SUB_HSS_LocationSystem_Geo_1600 * @tc.name TestgetAddressesFromLocation * @tc.desc Input parameter boundary test for the reverse address resolution function in a specified range. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0016', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1600', 0, async function (done) { let geocodeRequest1 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -588,14 +614,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 31.1537977881, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise1: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise1: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest2 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -604,14 +635,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 31.1537977881, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest2).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise2: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest2).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise2: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest3 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -620,13 +656,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 31.1537977881, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest3).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise3: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) == null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest3).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise3: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) == null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest4 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -635,14 +676,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 31.1537977881, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest4).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise4: " + JSON.stringify(result)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest4).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise4: " + JSON.stringify(result)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest5 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -651,14 +697,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": -90, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest5).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise5: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + try { + await geolocation.getAddressesFromLocationName(geocodeRequest5).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise5: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest6 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -667,14 +718,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 90, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest6).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise6: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest6).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise6: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest7 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -683,13 +739,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": -90.1, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest7).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise7: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) == null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest7).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise7: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) == null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest8 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -698,25 +759,30 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 90.1, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest8).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise8: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) == null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest8).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise8: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) == null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } done() }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0017 + * @tc.number SUB_HSS_LocationSystem_Geo_1700 * @tc.name TestgetAddressesFromLocation * @tc.desc Longitude input parameter boundary test for the reverse address resolution function in a specified range * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0017', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1700', 0, async function (done) { let geocodeRequest1 = { "description": "北京天安门", "maxItems": 1, @@ -725,14 +791,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": 116.45 }; - await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise1: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise1: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest2 = { "description": "北京天安门", "maxItems": 1, @@ -741,13 +812,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": 116.45 }; - await geolocation.getAddressesFromLocationName(geocodeRequest2).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise2: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest2).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise2: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest3 = { "description": "北京天安门", "maxItems": 1, @@ -756,13 +832,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": 116.45 }; - await geolocation.getAddressesFromLocationName(geocodeRequest3).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise3: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest3).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise3: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest4 = { "description": "北京天安门", "maxItems": 1, @@ -771,13 +852,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": 116.45 }; - await geolocation.getAddressesFromLocationName(geocodeRequest4).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise4: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest4).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise4: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest5 = { "description": "北京天安门", "maxItems": 1, @@ -786,13 +872,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": -180 }; - await geolocation.getAddressesFromLocationName(geocodeRequest5).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise5: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest5).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise5: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest6 = { "description": "北京天安门", "maxItems": 1, @@ -801,13 +892,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": 180 }; - await geolocation.getAddressesFromLocationName(geocodeRequest6).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise6: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest6).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise6: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest7 = { "description": "北京天安门", "maxItems": 1, @@ -816,13 +912,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": -180.1 }; - await geolocation.getAddressesFromLocationName(geocodeRequest7).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise7: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest7).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise7: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest8 = { "description": "北京天安门", "maxItems": 1, @@ -831,13 +932,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": 180.1 }; - await geolocation.getAddressesFromLocationName(geocodeRequest8).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise8: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest8).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise8: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } done(); }) }) + diff --git a/location/geolocation_standard/src/main/js/default/test/GetCountryCode.test.js b/location/geolocation_standard/src/main/js/default/test/GetCountryCode.test.js index adcc564f0d8228a5ad552df8c7b500af7e731cdc..b0fbb51d7497521c03a2768acaec36326156f86b 100644 --- a/location/geolocation_standard/src/main/js/default/test/GetCountryCode.test.js +++ b/location/geolocation_standard/src/main/js/default/test/GetCountryCode.test.js @@ -90,13 +90,13 @@ describe('geolocationTest_4', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_CountryCode_0001 + * @tc.number SUB_HSS_LocationSystem_CountryCode_0100 * @tc.name Test getCountryCode * @tc.desc Obtaining Country Code Information * @tc.type Function * @tc.level since 9 */ - it('SUB_HSS_LocationSystem_CountryCode_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_CountryCode_0100', 0, async function (done) { await geolocation.getCountryCode().then((result) => { console.info("[lbs_js] getCountryCode promise result: " + JSON.stringify(result)); console.info("[lbs_js] country :" + result.country); @@ -113,13 +113,13 @@ describe('geolocationTest_4', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_CountryCode_0002 + * @tc.number SUB_HSS_LocationSystem_CountryCode_0200 * @tc.name Test getCountryCode * @tc.desc Obtaining Country Code Information * @tc.type Function * @tc.level since 9 */ - it('SUB_HSS_LocationSystem_CountryCode_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_CountryCode_0200', 0, async function (done) { function getCountryCodeCallback() { return new Promise((resolve, reject) => { geolocation.getCountryCode((err) => { @@ -137,13 +137,13 @@ describe('geolocationTest_4', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_CountryCode_0003 + * @tc.number SUB_HSS_LocationSystem_CountryCode_0300 * @tc.name getCountryCode_on_off * @tc.desc The interception country code is changed. * @tc.type Function * @tc.level since 9 */ - it('SUB_HSS_LocationSystem_CountryCode_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_CountryCode_0300', 0, async function (done) { console.info("[lbs_js]countryCodeChange"); geolocation.on('countryCodeChange', function (data) { console.info('[lbs_js] countryCodeChange' +JSON.stringify(data) ); diff --git a/location/geolocation_standard/src/main/js/default/test/LocationTest.test.js b/location/geolocation_standard/src/main/js/default/test/LocationTest.test.js index 9801165b80ff89460c7a0a5c6067ead7ce324ebd..6e7dfa9d73cde9bff699355759b847eeee976396 100644 --- a/location/geolocation_standard/src/main/js/default/test/LocationTest.test.js +++ b/location/geolocation_standard/src/main/js/default/test/LocationTest.test.js @@ -111,14 +111,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number LocSwitch_0003 - * @tc.name SUB_HSS_LocationSystem_LocSwitch_0003 - * @tc.desc Test requestrequestEnableLocation api . + * @tc.number SUB_HSS_LocationSystem_LocSwitch_0300 + * @tc.name Test requestrequestEnableLocation api + * @tc.desc Enabling the Location Service Function for a Third-Party App - Callback * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocSwitch_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocSwitch_0300', 0, async function (done) { geolocation.isLocationEnabled(async (err, data) => { if (err) { console.info('[lbs_js] getLocationSwitchState callback err is : ' + JSON.stringify(err)); @@ -132,14 +132,14 @@ describe('geolocationTest_geo3', function () { }); /** - * @tc.number LocSwitch_0004 - * @tc.name SUB_HSS_LocationSystem_LocSwitch_0004 - * @tc.desc Test requestrequestEnableLocation api . + * @tc.number LocSwitch_0400 + * @tc.name Test requestrequestEnableLocation api. + * @tc.desc Enabling the Location Service Function for a Third-Party Application -Promise Mode * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocSwitch_0004', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocSwitch_0400', 0, async function (done) { await geolocation.isLocationEnabled().then((result1) => { console.info('[lbs_js] getLocationSwitchStateLocSwitch_0004 result: ' + JSON.stringify(result1)); expect(result1).assertTrue(); @@ -150,14 +150,14 @@ describe('geolocationTest_geo3', function () { }); /** - * @tc.number LocSwitch_0005 - * @tc.name SUB_HSS_LocationSystem_LocSwitch_0005 - * @tc.desc Test locationServiceState api . + * @tc.number SUB_HSS_LocationSystem_LocSwitch_0500 + * @tc.name Test locationServiceState api . + * @tc.desc Subscribe to the location service status change. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocSwitch_0005', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocSwitch_0500', 0, async function (done) { console.log('just for overwriting,locationServiceState test need system api '); var locationServiceState = (state) => { console.log('locationServiceState: state: ' + JSON.stringify(state)); @@ -168,14 +168,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0001 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0100 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request in a specified scenario and set the navigation scenario.. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0100', 0, async function (done) { let currentLocationRequest = { "priority": 0x200, "scenario": 0x301, "timeoutMs": 1000, "maxAccuracy": 0 }; function getCurrentLocationCallback() { return new Promise((resolve, reject) => { @@ -193,24 +193,25 @@ describe('geolocationTest_geo3', function () { }) } console.info('getCurrentLocationCallback start'); - await getCurrentLocationCallback().then(() => { - console.info('getCurrentLocationCallback resolve'); - }, () => { - console.info('getCurrentLocationCallback reject'); - }); - console.info('getCurrentLocationCallback end'); + await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { + console.info("getCurrentLocation callback_0003, result: " + JSON.stringify(result)); + expect(true).assertEqual(result != null); + }).catch(error => { + console.info('getCurrentLocation callback_0003:' + JSON.stringify(error)); + expect(true).assertEqual(JSON.stringify(error) != null); + }) done(); }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0002 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0200 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request in a specified scenario and set the navigation scenario.. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0200', 0, async function (done) { let currentLocationRequest = { "priority": 0x203, "scenario": 0x301, "timeoutMs": 1000, "maxAccuracy": 0 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { console.info('[lbs_js] getCurrentLocation promise result ' + JSON.stringify(result)); @@ -223,14 +224,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0003 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0300 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request in a specified scenario and set the track tracing scenario. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0300', 0, async function (done) { let currentLocationRequest = { "priority": 0x200, "scenario": 0x302, "timeoutMs": 1000, "maxAccuracy": 10 }; function getCurrentLocationCallback() { return new Promise((resolve, reject) => { @@ -248,24 +249,25 @@ describe('geolocationTest_geo3', function () { }) } console.info('getCurrentLocationCallback start'); - await getCurrentLocationCallback().then(() => { - console.info('getCurrentLocationCallback resolve'); - }, () => { - console.info('getCurrentLocationCallback reject'); - }); - console.info('getCurrentLocationCallback end'); + await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { + console.info("getCurrentLocation callback_0003, result: " + JSON.stringify(result)); + expect(true).assertEqual(result != null); + }).catch(error => { + console.info('getCurrentLocation callback_0003:' + JSON.stringify(error)); + expect(true).assertEqual(JSON.stringify(error) != null); + }) done(); }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0004 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0400 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request in a specified scenario and set a car-sharing scenario. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0004', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0400', 0, async function (done) { let currentLocationRequest = { "priority": 0x200, "scenario": 0x303, "timeoutMs": 1000, "maxAccuracy": 10 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { console.info('[lbs_js] getCurrentLocation promise result004 ' + JSON.stringify(result)); @@ -278,14 +280,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0005 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0500 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request in a specified scenario and set the life service scenario.. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0005', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0500', 0, async function (done) { let currentLocationRequest = { "priority": 0x200, "scenario": 0x304, "timeoutMs": 1000, "maxAccuracy": 0 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { console.info('[lbs_js] getCurrentLocation promise result005 ' + JSON.stringify(result)); @@ -298,7 +300,7 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0006 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0600 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request in a specified scenario * and set the scenario with no power consumption. @@ -306,7 +308,7 @@ describe('geolocationTest_geo3', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0006', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0600', 0, async function (done) { let currentLocationRequest1 = { "priority": 0x200, "scenario": 0x305, "timeoutMs": 1000, "maxAccuracy": 10 }; let currentLocationRequest2 = { "priority": 0x200, "scenario": 0x301, "timeoutMs": 1000, "maxAccuracy": 10 }; await geolocation.getCurrentLocation(currentLocationRequest1).then((result) => { @@ -326,14 +328,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0007 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0700 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request with the parameter set to high-precision priority location request. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0007', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0700', 0, async function (done) { let currentLocationRequest = { "priority": 0x0201, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": 10 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { console.info('[lbs_js] getCurrentLocation promise result007 ' + JSON.stringify(result)); @@ -346,14 +348,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0008 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0800 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request with parameters set to fast location and priority location request. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0008', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0800', 0, async function (done) { let currentLocationRequest = { "priority": 0x0203, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": 10 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { console.info('[lbs_js] getCurrentLocation promise result010 ' + JSON.stringify(result)); @@ -366,14 +368,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0009 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0900 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request with parameters set to low power consumption. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0009', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0900', 0, async function (done) { let currentLocationRequest = { "priority": 0x0202, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": 0 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { console.info('[lbs_js] getCurrentLocation promise result009 ' + JSON.stringify(result)); @@ -386,14 +388,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0010 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0100 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request and set the location reporting precision. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0010', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0100', 0, async function (done) { let currentLocationRequest = { "priority": 0x0200, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": 5 }; let currentLocationRequest1 = { "priority": 0x0200, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": 2 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { @@ -412,7 +414,7 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0011 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_1100 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request for specific configuration * and set the reporting precision of abnormal location. @@ -420,7 +422,7 @@ describe('geolocationTest_geo3', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0011', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_1100', 0, async function (done) { let currentLocationRequest = { "priority": 0x0201, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": 0 }; let currentLocationRequest1 = { "priority": 0x0201, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": -1 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { @@ -440,14 +442,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0012 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_1200 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request and set the location timeout interval. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0012', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_1200', 0, async function (done) { let currentLocationRequest = { "priority": 0x0201, "scenario": 0x0301, "timeoutMs": 1000, "maxAccuracy": 0 }; let currentLocationRequest1 = { "priority": 0x0201, "scenario": 0x0301, "timeoutMs": 1000, "maxAccuracy": 0 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { @@ -467,14 +469,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0013 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_1300 * @tc.name Test getCurrentLocation * @tc.desc Initiate a specified single location request and set the exception location timeout interval. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0013', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_1300', 0, async function (done) { let currentLocationRequest = { "priority": 0x0201, "scenario": 0x0302, "timeoutMs": 0, "maxAccuracy": 0 }; let currentLocationRequest1 = { "priority": 0x0201, "scenario": 0x0302, "timeoutMs": -1000, "maxAccuracy": 0 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { @@ -496,14 +498,14 @@ describe('geolocationTest_geo3', function () { /** - * @tc.number SUB_HSS_SendCommand_callback + * @tc.number SUB_HSS_SendCommand_0100 * @tc.name Test sendCommand * @tc.desc Test sendCommand api . * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_SendCommand_callback', 0, async function (done) { + it('SUB_HSS_SendCommand_0100', 0, async function (done) { let requestInfo = { 'scenairo': 0x301, 'command': "command_1" }; await geolocation.sendCommand(requestInfo, (err, result) => { if (err) { @@ -516,14 +518,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_SendCommand_promise + * @tc.number SUB_HSS_SendCommand_0200 * @tc.name Test sendCommand * @tc.desc Test sendCommand1 api . * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_SendCommand_promise', 0, async function (done) { + it('SUB_HSS_SendCommand_0200', 0, async function (done) { let requestInfo = { 'scenairo': 0x301, 'command': "command_1" }; geolocation.sendCommand(requestInfo).then((result) => { console.info('sendCommand promise result:' + result); @@ -536,14 +538,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0001 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0100 * @tc.name Test locationChange * @tc.desc Initiate a request for continuous positioning in a specified scenario and set the navigation scenario. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0100', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":5, "distanceInterval": 0, "maxAccuracy": 0}; @@ -557,14 +559,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0002 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0200 * @tc.name Test locationChange * @tc.desc Initiate a request for continuous positioning in a specified scenario and set a track tracing scenario. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0200', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x302, "timeInterval":1, "distanceInterval": 5, "maxAccuracy": 10}; @@ -578,14 +580,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0003 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0300 * @tc.name Test locationChange * @tc.desc Initiate a continuous location request in a specified scenario and set a car-sharing scenario. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0300', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x303, "timeInterval":5, "distanceInterval": 5, "maxAccuracy": 10}; @@ -599,14 +601,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0004 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0400 * @tc.name Test locationChange * @tc.desc Initiate a continuous location request in a specified scenario and set a life service scenario. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0004', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0400', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x303, "timeInterval":1, "distanceInterval": 5, "maxAccuracy": 0}; @@ -620,7 +622,7 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0005 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0500 * @tc.name Test locationChange * @tc.desc Initiate a continuous location request in a specified scenario * and set the scenario with no power consumption. @@ -628,7 +630,7 @@ describe('geolocationTest_geo3', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0005', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0500', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x305, "timeInterval":1, "distanceInterval": 5, "maxAccuracy": 10}; @@ -648,7 +650,7 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0007 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0700 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous positioning request and * set the parameter to high-precision priority positioning request. @@ -656,7 +658,7 @@ describe('geolocationTest_geo3', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0007', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0700', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x201, "scenario":0x300, "timeInterval":1, "distanceInterval": 5, "maxAccuracy": 10}; @@ -670,7 +672,7 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0008 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0800 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous positioning request with the parameter * set to fast positioning and priority positioning request. @@ -678,7 +680,7 @@ describe('geolocationTest_geo3', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0008', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0800', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x203, "scenario":0x300, "timeInterval":5, "distanceInterval": 5, "maxAccuracy": 10}; @@ -692,7 +694,7 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0009 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0900 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous positioning request with the parameter * set to low power consumption type. @@ -700,7 +702,7 @@ describe('geolocationTest_geo3', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0009', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0900', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x202, "scenario":0x300, "timeInterval":1, "distanceInterval": 5, "maxAccuracy": 10} @@ -714,14 +716,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0010 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0100 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous location request and set the reporting interval. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0010', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0100', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":3, "distanceInterval": 0, "maxAccuracy": 0}; @@ -735,14 +737,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0011 + * @tc.number SUB_HSS_LocationSystem_LocRequest_1100 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous location request and set the location reporting interval. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0011', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_1100', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":5, "distanceInterval": 0, "maxAccuracy": 0}; @@ -756,14 +758,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0012 + * @tc.number SUB_HSS_LocationSystem_LocRequest_1200 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous location request and set the interval for reporting exceptions. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0012', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_1200', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 0}; @@ -777,14 +779,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0013 + * @tc.number SUB_HSS_LocationSystem_LocRequest_1300 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous location request and set the interval for reporting abnormal locations. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0013', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_1300', 0, async function (done) { enableLocationSwitch(); let requestInfo1 = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 0}; @@ -806,14 +808,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0014 + * @tc.number SUB_HSS_LocationSystem_LocRequest_1400 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous positioning request and set the positioning reporting precision. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0014', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_1400', 0, async function (done) { enableLocationSwitch(); let requestInfo1 = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 5}; @@ -835,14 +837,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0015 + * @tc.number SUB_HSS_LocationSystem_LocRequest_1500 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous location request and set the reporting precision of abnormal location. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0015', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_1500', 0, async function (done) { enableLocationSwitch(); let requestInfo1 = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 0}; @@ -864,14 +866,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LastLoc_0001 + * @tc.number SUB_HSS_LocationSystem_LastLoc_0100 * @tc.name Test getLastLocation * @tc.desc Obtain the last location after a single location. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LastLoc_0001', 0, async function(done) { + it('SUB_HSS_LocationSystem_LastLoc_0100', 0, async function(done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 0}; @@ -889,7 +891,7 @@ describe('geolocationTest_geo3', function () { +' accuracy: ' + result.accuracy+' speed: ' + result.speed + 'timeStamp: ' + result.timeStamp+'direction:' + result.direction+' timeSinceBoot: ' + result.timeSinceBoot +'additions: ' + result.additions+' additionSize' + result.additionSize - +'isFromMock'+ result.isFromMock); + + 'isFromMock' +result.isFromMock); }).catch((error) => { console.info("[lbs_js] getLastLocation promise then error:" + JSON.stringify(error)); console.info('[lbs_js] not support now'); @@ -899,14 +901,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LastLoc_0002 + * @tc.number SUB_HSS_LocationSystem_LastLoc_0200 * @tc.name Test getLastLocation * @tc.desc Obtain the last location after continuous positioning. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LastLoc_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_LastLoc_0200', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 0}; @@ -916,27 +918,34 @@ describe('geolocationTest_geo3', function () { }; geolocation.on('locationChange', requestInfo, locationChange); geolocation.off('locationChange', locationChange); - geolocation.getLastLocation(async (err, data) => { - if (err) { - console.info('[LastLoc_0002] getLastLocation callback err is : ' + JSON.stringify(err)); - } else { - console.info('[LastLoc_0002] getLastLocation callback result: ' + JSON.stringify(data)); - expect(data).assertTrue(); - } - done() - }) + + function getLastLocationCallback(){ + return new Promise((resolve, reject)=>{ + geolocation.getLastLocation((err, data) => { + if (err) { + console.info('[LastLoc_0002] getLastLocation callback err is : ' + JSON.stringify(err)); + expect(true).assertEqual(err !=null); + } else { + console.info('[LastLoc_0002] getLastLocation callback result: ' + JSON.stringify(data)); + expect(true).assertEqual(data !=null); + } + resolve(); + }); + }) + } + await getLastLocationCallback(); done(); }) /** - * @tc.number SUB_HSS_LocationSystem_Gnss_0001 + * @tc.number SUB_HSS_LocationSystem_Gnss_0100 * @tc.name Test gnssStatusChange * @tc.desc Monitoring Satellite Information Reporting * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Gnss_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_Gnss_0100', 0, async function (done) { await changedLocationMode(); var gnssStatusCb = (satelliteStatusInfo) => { console.info('gnssStatusChange: ' + satelliteStatusInfo); @@ -961,14 +970,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Gnss_0002 + * @tc.number SUB_HSS_LocationSystem_Gnss_0200 * @tc.name Test nmeaMessageChange * @tc.desc Monitoring NMEA Information Reporting * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Gnss_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_Gnss_0200', 0, async function (done) { await changedLocationMode(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 0}; @@ -987,14 +996,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Batching_0001 + * @tc.number SUB_HSS_LocationSystem_Batching_0100 * @tc.name Test cachedGnssLocationsReporting * @tc.desc Setting the Gnss Batching Reporting Interval * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Batching_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_Batching_0100', 0, async function (done) { var cachedLocationsCb1 = (locations) => { console.log('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations)); expect(true).assertEqual(locations !=null); @@ -1013,14 +1022,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Batching_0002 + * @tc.number SUB_HSS_LocationSystem_Batching_0200 * @tc.name Test cachedGnssLocationsReporting * @tc.desc Setting the Gnss Batching Cache Queue to Be Reported When the Gnss Batching Cache Queue Is Full * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Batching_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_Batching_0200', 0, async function (done) { var cachedLocationsCb = (locations) => { console.log('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations)); expect(true).assertEqual(locations !=null); @@ -1034,14 +1043,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Batching_0003 + * @tc.number SUB_HSS_LocationSystem_Batching_0300 * @tc.name Test getCachedGnssLocationsSize * @tc.desc Obtains the number of GNSS data records in the batching process. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Batching_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_Batching_0300', 0, async function (done) { var cachedLocationsCb = (locations) => { console.log('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations)); expect(true).assertEqual(locations !=null); @@ -1051,29 +1060,44 @@ describe('geolocationTest_geo3', function () { "distanceInterval": 0, "maxAccuracy": 0}; geolocation.on('cachedGnssLocationsReporting', CachedGnssLoactionsRequest, cachedLocationsCb); geolocation.off('cachedGnssLocationsReporting',cachedLocationsCb); - geolocation.getCachedGnssLocationsSize((err, data) => { - if (err) { - console.info('[lbs_js] getCachedGnssLocationsSize callback err is : ' + err); - expect(true).assertTrue(err != null); - done(); - }else { - console.info("[lbs_js] getCachedGnssLocationsSize callback data is: " + JSON.stringify(data)); - expect(true).assertTrue(data != null); - done() - } - }); +// geolocation.getCachedGnssLocationsSize((err, data) => { +// if (err) { +// console.info('[lbs_js] getCachedGnssLocationsSize callback err is : ' + err); +// expect(true).assertTrue(err != null); +// done(); +// }else { +// console.info("[lbs_js] getCachedGnssLocationsSize callback data is: " + JSON.stringify(data)); +// expect(true).assertTrue(data != null); +// done() +// } +// }); + function getCachedGnssLocationsSizeCallback(){ + return new Promise((resolve, reject)=>{ + geolocation.getCachedGnssLocationsSize((err, data) => { + if (err) { + console.info('[lbs_js] getCachedGnssLocationsSize callback err is : ' + JSON.stringify(err)); + expect(true).assertTrue(err != null); + }else { + console.info("[lbs_js] getCachedGnssLocationsSize callback data is: " + JSON.stringify(data)); + expect(true).assertTrue(data != null); + } + resolve(); + }); + }) + } + await getCachedGnssLocationsSizeCallback(); done(); }) /** - * @tc.number SUB_HSS_LocationSystem_Batching_0004 + * @tc.number SUB_HSS_LocationSystem_Batching_0400 * @tc.name Test getCachedGnssLocationsSize * @tc.desc Obtains the number of GNSS data records in the batching process. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Batching_0004', 0, async function (done) { + it('SUB_HSS_LocationSystem_Batching_0400', 0, async function (done) { var cachedLocationsCb = (locations) => { console.log('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations)); expect(true).assertEqual(locations !=null); @@ -1095,14 +1119,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Batching_0005 + * @tc.number SUB_HSS_LocationSystem_Batching_0500 * @tc.name Test flushCachedGnssLocations * @tc.desc Obtains the GNSS data of the current batching. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Batching_0005', 0, async function (done) { + it('SUB_HSS_LocationSystem_Batching_0500', 0, async function (done) { var cachedLocationsCb = (locations) => { console.log('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations)); expect(true).assertEqual(locations !=null); @@ -1112,29 +1136,33 @@ describe('geolocationTest_geo3', function () { "distanceInterval": 0, "maxAccuracy": 0}; geolocation.on('cachedGnssLocationsReporting', CachedGnssLoactionsRequest, cachedLocationsCb); geolocation.off('cachedGnssLocationsReporting',cachedLocationsCb); - geolocation.flushCachedGnssLocations((err, data) => { - if (err) { - console.info('[lbs_js] flushCachedGnssLocations callback err is : ' + err); - expect(true).assertTrue(err != null); - done(); - }else { - console.info("[lbs_js] flushCachedGnssLocations callback data is: " + JSON.stringify(data)); - expect(true).assertTrue(data); - done(); - } - }); + function flushCachedGnssLocationsCallback(){ + return new Promise((resolve, reject)=>{ + geolocation.flushCachedGnssLocations((err, data) => { + if (err) { + console.info('[lbs_js] flushCachedGnssLocations callback err is : ' + JSON.stringify(err)); + expect(true).assertTrue(err != null); + }else { + console.info("[lbs_js] flushCachedGnssLocations callback data is: " + JSON.stringify(data)); + expect(true).assertTrue(data); + } + resolve(); + }); + }) + } + await flushCachedGnssLocationsCallback(); done(); }) /** - * @tc.number SUB_HSS_LocationSystem_Batching_0006 + * @tc.number SUB_HSS_LocationSystem_Batching_0600 * @tc.name Test flushCachedGnssLocations * @tc.desc Obtain the GNSS data of the current batching. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Batching_0006', 0, async function (done) { + it('SUB_HSS_LocationSystem_Batching_0600', 0, async function (done) { var cachedLocationsCb = (locations) => { console.log('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations)); expect(true).assertEqual(locations !=null); @@ -1157,14 +1185,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_GeoFence_0001 + * @tc.number SUB_HSS_LocationSystem_GeoFence_0100 * @tc.name Test fenceStatusChange * @tc.desc Gnss fence function test * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('SUB_HSS_LocationSystem_GeoFence_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_GeoFence_0100', 0, async function (done) { await changedLocationMode(); let geofence = {"latitude": 31.12, "longitude": 121.11, "radius": 1,"expiration": ""}; let geofenceRequest = {"priority":0x200, "scenario":0x301, "geofence": geofence}; @@ -1194,14 +1222,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_GeoFence_0005 + * @tc.number SUB_HSS_LocationSystem_GeoFence_0500 * @tc.name Test fenceStatusChange * @tc.desc Test the function of locating the validity period of the fence. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('SUB_HSS_LocationSystem_GeoFence_0005', 0, async function (done) { + it('SUB_HSS_LocationSystem_GeoFence_0500', 0, async function (done) { await changedLocationMode(); let geofence = {"latitude": 31.12, "longitude": 121.11, "radius": 1,"expiration": ""}; let geofenceRequest = {"priority":0x203, "scenario":0x301, "geofence": geofence}; diff --git a/location/geolocation_standard/src/main/js/default/test/SystemLocation.test.js b/location/geolocation_standard/src/main/js/default/test/SystemLocation.test.js index 0e416e6536acf7463ce575b43c315842a8a249c5..cb4abac83a06440461a88bacecdc539ec387eb1d 100644 --- a/location/geolocation_standard/src/main/js/default/test/SystemLocation.test.js +++ b/location/geolocation_standard/src/main/js/default/test/SystemLocation.test.js @@ -81,16 +81,16 @@ describe('geolocationTest_geo2', function () { }) afterEach(function () { }) - + /** - * @tc.number SUB_HSS_LocationSystem_systemapi_0001 + * @tc.number SUB_HSS_LocationSystem_systemapi_0100 * @tc.name Test getLocation * @tc.desc Obtains the geographical location of a device.. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_systemapi_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_systemapi_0100', 0, async function (done) { geolocations.getLocation({ timeout:30000, coordType:'wgs84', @@ -127,14 +127,14 @@ describe('geolocationTest_geo2', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_systemapi_0002 + * @tc.number SUB_HSS_LocationSystem_systemapi_0200 * @tc.name Test subscribe and unsubscribe * @tc.desc Test subscribe api . * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_systemapi_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_systemapi_0200', 0, async function (done) { geolocations.subscribe({ coordType:'wgs84', success: function(data) { @@ -152,14 +152,14 @@ describe('geolocationTest_geo2', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_systemapi_0003 + * @tc.number SUB_HSS_LocationSystem_systemapi_0300 * @tc.name test getLocationType * @tc.desc Subscribing to geographical location information . * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_systemapi_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_systemapi_0300', 0, async function (done) { geolocations.getLocationType({ success: function(data) { console.log('success get location type:' + JSON.stringify(data)); @@ -178,14 +178,14 @@ describe('geolocationTest_geo2', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_systemapi_0004 + * @tc.number SUB_HSS_LocationSystem_systemapi_0400 * @tc.name Test getSupportedCoordTypes * @tc.desc Obtains the geographical location of a device.. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_systemapi_0004', 0, function () { + it('SUB_HSS_LocationSystem_systemapi_0400', 0, function () { let types = geolocations.getSupportedCoordTypes(); console.info('[lbs_js] getSupportedCoordTypes result: ' + JSON.stringify(types)); expect(true).assertEqual(types.length !=0); @@ -196,9 +196,3 @@ describe('geolocationTest_geo2', function () { - - - - - -