From 39856ffcdc9477c7c0726cf90e239e472fc51e2e Mon Sep 17 00:00:00 2001 From: li-yaoyao777 Date: Tue, 24 May 2022 16:39:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-yaoyao777 --- .../plugin/test/ExampleJsunit.test_system.js | 2 +- .../test/unittest/ExampleJsunit.test.js | 44 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/interfaces/plugin/test/ExampleJsunit.test_system.js b/interfaces/plugin/test/ExampleJsunit.test_system.js index a966ce2f..47662a51 100644 --- a/interfaces/plugin/test/ExampleJsunit.test_system.js +++ b/interfaces/plugin/test/ExampleJsunit.test_system.js @@ -373,7 +373,7 @@ describe("SensorJsTest", function () { console.info('----------------------SensorJsTest013---------------------------'); sensor.subscribeOnBodyState({ success: function(data) { - expect(typeof(data.value)).assertEqual("number"); + expect(typeof(data.value)).assertEqual("boolean"); console.info("SensorJsTest013 subscribeOnBodyState" + JSON.stringify(data)); }, fail: function(data, code) { diff --git a/interfaces/plugin/test/unittest/ExampleJsunit.test.js b/interfaces/plugin/test/unittest/ExampleJsunit.test.js index c81d1f35..43b1e690 100644 --- a/interfaces/plugin/test/unittest/ExampleJsunit.test.js +++ b/interfaces/plugin/test/unittest/ExampleJsunit.test.js @@ -63,7 +63,7 @@ describe("SensorJsTest", function () { */ it("SensorJsTest001", 0, async function (done) { console.info('----------------------SensorJsTest001---------------------------'); - sensor.on(0, callback); + sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback); setTimeout(()=>{ sensor.off(0); done(); @@ -100,7 +100,7 @@ describe("SensorJsTest", function () { */ it("SensorJsTest003", 0, async function (done) { console.info('----------------------SensorJsTest003---------------------------'); - sensor.on(0, callback, {'interval': 100000000}); + sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback, {'interval': 100000000}); setTimeout(()=>{ console.info('----------------------SensorJsTest003 off in---------------------------'); sensor.off(0); @@ -123,7 +123,7 @@ describe("SensorJsTest", function () { done(); } try { - sensor.on(0, onSensorCallback, {'interval': 100000000}, 5); + sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, onSensorCallback, {'interval': 100000000}, 5); } catch (error) { console.info(error); expect(true).assertTrue(); @@ -138,7 +138,7 @@ describe("SensorJsTest", function () { * @tc.require: Issue Number */ it("SensorJsTest005", 0, async function (done) { - sensor.once(0, callback); + sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback); setTimeout(()=>{ expect(true).assertTrue(); done(); @@ -179,7 +179,7 @@ describe("SensorJsTest", function () { done(); } try{ - sensor.once(0, onceSensorCallback, 5); + sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, onceSensorCallback, 5); } catch (error) { console.info(error); expect(true).assertTrue(); @@ -215,8 +215,8 @@ describe("SensorJsTest", function () { expect(false).assertTrue(); done(); } - sensor.on(0, onSensorCallback); - sensor.off(0, onSensorCallback); + sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, onSensorCallback); + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, onSensorCallback); setTimeout(()=>{ expect(true).assertTrue(); done(); @@ -251,8 +251,8 @@ describe("SensorJsTest", function () { * @tc.require: Issue Number */ it("SensorJsTest011", 0, async function (done) { - sensor.on(0, callback); - sensor.on(0, callback2); + sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback); + sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback2); setTimeout(()=>{ console.info('----------------------SensorJsTest011 off in---------------------------'); sensor.off(0); @@ -268,16 +268,16 @@ describe("SensorJsTest", function () { * @tc.require: Issue Number */ it("SensorJsTest012", 0, async function (done) { - sensor.on(0, callback); - sensor.on(0, callback2); + sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback); + sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback2); setTimeout(()=>{ console.info('----------------------SensorJsTest012 off in---------------------------'); - sensor.off(0, callback); + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback); console.info('----------------------SensorJsTest012 off end---------------------------'); }, 500); setTimeout(()=>{ console.info('----------------------SensorJsTest012 off in---------------------------'); - sensor.off(0, callback2); + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback2); console.info('----------------------SensorJsTest012 off end---------------------------'); done(); }, 1000); @@ -291,7 +291,7 @@ describe("SensorJsTest", function () { */ it("SensorJsTest013", 0, function (done) { try { - sensor.off(0, 5); + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, 5); } catch (error) { console.info(error); expect(true).assertTrue(); @@ -307,8 +307,8 @@ describe("SensorJsTest", function () { */ it("SensorJsTest014", 0, async function (done) { console.info('----------------------SensorJsTest014---------------------------'); - sensor.on(0, callback, {'interval': 100000000}); - sensor.once(0, callback2); + sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback, {'interval': 100000000}); + sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback2); setTimeout(()=>{ console.info('----------------------SensorJsTest014 off in---------------------------'); sensor.off(0); @@ -325,16 +325,16 @@ describe("SensorJsTest", function () { */ it("SensorJsTest015", 0, async function (done) { console.info('----------------------SensorJsTest015---------------------------'); - sensor.on(0, callback, {'interval': 100000000}); - sensor.on(0, callback2, {'interval': 100000000}); + sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback, {'interval': 100000000}); + sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback2, {'interval': 100000000}); setTimeout(()=>{ console.info('----------------------SensorJsTest015 off in---------------------------'); - sensor.off(0, callback); + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback); console.info('----------------------SensorJsTest015 off end---------------------------'); }, 500); setTimeout(()=>{ console.info('----------------------SensorJsTest015 off in---------------------------'); - sensor.off(0, callback2); + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback2); console.info('----------------------SensorJsTest015 off end---------------------------'); done(); }, 1000); @@ -348,8 +348,8 @@ describe("SensorJsTest", function () { */ it("SensorJsTest016", 0, async function (done) { console.info('----------------------SensorJsTest016---------------------------'); - sensor.on(0, callback, {'interval': 100000000}); - sensor.on(0, callback2, {'interval': 100000000}); + sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback, {'interval': 100000000}); + sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback2, {'interval': 100000000}); setTimeout(()=>{ console.info('----------------------SensorJsTest016 off in---------------------------'); sensor.off(0); -- Gitee