diff --git a/sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test.js b/sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test.js index ee7d27dfaaf0a395f6eaa6ddbb0de59cb0cf0048..5bbb0f7abcb09e5f1eb266771e940f7f73cb04b5 100755 --- a/sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test.js +++ b/sensors/sensor_standard/src/main/js/default/test/SensorOnOffTest.test.js @@ -78,18 +78,19 @@ describe('SystemParameterTest', function () { */ it('SUB_SENSORS_Sensor_JSTest_0020', 0, async function (done) { console.info('SUB_SENSORS_Sensor_JSTest_0020 start'); - await sensor.on(testNullSensorId, function (data) { - if (data) { - console.info('testRegisterSensortest002 on success'); - expect(false).assertTrue(); - done(); - } - }); - setTimeout(() => { + function onSensorCallback(data) { + console.info('SensorJsTest002 on error'); + expect(false).assertTrue(); + done(); + } + try { + sensor.on(testNullSensorId, onSensorCallback); + } catch (error) { + console.info(error); expect(true).assertTrue(); done(); - }, 500) - console.info('SUB_SENSORS_Sensor_JSTest_0020 end'); + } + console.info('SUB_SENSORS_Sensor_JSTest_0020 end'); }) }) \ No newline at end of file