diff --git a/interfaces/plugin/test/unittest/ExampleJsunit.test.js b/interfaces/plugin/test/unittest/ExampleJsunit.test.js index fdd888d88f66d2e5fe49b3ea6d4b7e3aac8655d8..846955438d7e453f9c06417dfa17335b617869cd 100644 --- a/interfaces/plugin/test/unittest/ExampleJsunit.test.js +++ b/interfaces/plugin/test/unittest/ExampleJsunit.test.js @@ -357,120 +357,6 @@ describe("SensorJsTest", function () { let timeMillis = [1580486400000, 1612108800000, 1643644800000, 1675180800000, 1706716800000] - /** - * test - * - * @tc.name: SensorJsTest_017 - * @tc.desc: Verification results of the incorrect parameters of the test interface. - * @tc.require: AR000GH2U6 - * @tc.author: - */ - it('SensorJsTest_017', 0, async function (done) { - console.info("---------------------------SensorJsTest_017----------------------------------"); - let promiseArray = [] - for (let i = 0; i < timeMillis.length; i++) { - promiseArray.push(new Promise((resolve, reject) => { - let j = i - sensor.getGeomagneticField({'latitude':80, 'longitude':0, 'altitude':0}, timeMillis[j], (error, data) => { - if (error) { - console.info('SensorJsTest_017 failed'); - expect(false).assertTrue(); - setTimeout(() =>{ - reject() - }, 500) - } else { - console.info('SensorJsTest_017 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip - + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) - expect(data.x).assertEqual(GEOMAGNETIC_COMPONENT_YEAR_RESULT[j][0]) - expect(data.y).assertEqual(GEOMAGNETIC_COMPONENT_YEAR_RESULT[j][1]) - expect(data.z).assertEqual(GEOMAGNETIC_COMPONENT_YEAR_RESULT[j][2]) - expect(data.deflectionAngle).assertEqual(GEOMAGNETIC_COMPONENT_YEAR_RESULT[j][3]) - expect(data.geomagneticDip).assertEqual(GEOMAGNETIC_COMPONENT_YEAR_RESULT[j][4]) - expect(data.levelIntensity).assertEqual(GEOMAGNETIC_COMPONENT_YEAR_RESULT[j][5]) - expect(data.totalIntensity).assertEqual(GEOMAGNETIC_COMPONENT_YEAR_RESULT[j][6]) - setTimeout(() =>{ - resolve() - }, 500) - } - }) - })) - } - Promise.all(promiseArray).then(done) - }) - - /** - * test - * - * @tc.name: SensorJsTest_018 - * @tc.desc: Verification results of the incorrect parameters of the test interface. - * @tc.require: AR000GH2U6 - * @tc.author: - */ - it('SensorJsTest_018', 0, async function (done) { - console.info("---------------------------SensorJsTest_018----------------------------------"); - let promiseArray = [] - for (let i = 0; i < GEOMAGNETIC_COORDINATES.length; i++) { - promiseArray.push(new Promise((resolve, reject) => { - let j = i - sensor.getGeomagneticField({'latitude':GEOMAGNETIC_COORDINATES[j][0], 'longitude':GEOMAGNETIC_COORDINATES[j][1], 'altitude':GEOMAGNETIC_COORDINATES[j][2]}, timeMillis[0], (error, data) => { - if (error) { - console.info('SensorJsTest_018 failed'); - expect(false).assertTrue(); - setTimeout(() =>{ - reject() - }, 500) - } else { - console.info('SensorJsTest_018 success x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip - + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) - expect(data.x).assertEqual(GEOMAGNETIC_COMPONENT_COORDINATES_RESULT[j][0]) - expect(data.y).assertEqual(GEOMAGNETIC_COMPONENT_COORDINATES_RESULT[j][1]) - expect(data.z).assertEqual(GEOMAGNETIC_COMPONENT_COORDINATES_RESULT[j][2]) - expect(data.deflectionAngle).assertEqual(GEOMAGNETIC_COMPONENT_COORDINATES_RESULT[j][3]) - expect(data.geomagneticDip).assertEqual(GEOMAGNETIC_COMPONENT_COORDINATES_RESULT[j][4]) - expect(data.levelIntensity).assertEqual(GEOMAGNETIC_COMPONENT_COORDINATES_RESULT[j][5]) - expect(data.totalIntensity).assertEqual(GEOMAGNETIC_COMPONENT_COORDINATES_RESULT[j][6]) - setTimeout(() =>{ - resolve() - }, 500) - } - }) - })) - } - Promise.all(promiseArray).then(done) - }) - - /** - * test - * - * @tc.name: SensorJsTest_019 - * @tc.desc: Verification results of the incorrect parameters of the test interface. - * @tc.require: AR000GH2U6 - * @tc.author: - */ - it('SensorJsTest_019', 0, async function (done) { - console.info("---------------------------SensorJsTest_019----------------------------------"); - let geomagneticComponent = [27779.234375, -6214.9794921875, -14924.6611328125, -27.667943954467773, -12.610970497131348, 28465.9765625, 32141.2109375] - sensor.getGeomagneticField({'latitude':0, 'longitude':0, 'altitude':0}, Number.MAX_VALUE, (error, data) => { - if (error) { - console.info('SensorJsTest_019 failed'); - expect(false).assertTrue(); - } else { - console.info('SensorJsTest_019 x: ' + data.x + ',y: ' + data.y + ',z: ' + data.z + ',geomagneticDip: ' + data.geomagneticDip - + ',deflectionAngle: ' + data.deflectionAngle + ',levelIntensity: ' + data.levelIntensity + ',totalIntensity: ' + data.totalIntensity) - expect(data.x).assertEqual(geomagneticComponent[0]) - expect(data.y).assertEqual(geomagneticComponent[1]) - expect(data.z).assertEqual(geomagneticComponent[2]) - expect(data.geomagneticDip).assertEqual(geomagneticComponent[3]) - expect(data.deflectionAngle).assertEqual(geomagneticComponent[4]) - expect(data.levelIntensity).assertEqual(geomagneticComponent[5]) - expect(data.totalIntensity).assertEqual(geomagneticComponent[6]) - } - setTimeout(() =>{ - done() - }, 500) - }) - }) - /** * test *