未验证 提交 b19968fa 编写于 作者: O openharmony_ci 提交者: Gitee

!5839 modify case about xts

Merge pull request !5839 from 17349030869/master
...@@ -50,6 +50,9 @@ describe("SensorJsTest_sensor_1", function () { ...@@ -50,6 +50,9 @@ describe("SensorJsTest_sensor_1", function () {
console.info('afterEach caled') console.info('afterEach caled')
}) })
let PARAMETER_ERROR_CODE = 401
let PARAMETER_ERROR_MSG = 'The parameter invalid.'
let SENSOR_DATA_MATRIX = [ let SENSOR_DATA_MATRIX = [
{ {
"rotation": [-0.7980074882507324, 0.5486301183700562, 0.24937734007835388, -0.17277367413043976, "rotation": [-0.7980074882507324, 0.5486301183700562, 0.24937734007835388, -0.17277367413043976,
...@@ -282,17 +285,24 @@ describe("SensorJsTest_sensor_1", function () { ...@@ -282,17 +285,24 @@ describe("SensorJsTest_sensor_1", function () {
* @tc.number:SUB_SensorsSystem_GeneralAlgorithm_JsTest_0100 * @tc.number:SUB_SensorsSystem_GeneralAlgorithm_JsTest_0100
*/ */
it('SensorJsTest_077', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it('SensorJsTest_077', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
sensor.getDirection([1, 2, 3, 1, 2, 3, 1, 2, 3, 0]).then((data) => { try {
for (let i = 0; i < data.length; i++) { sensor.getDirection([1, 2, 3, 1, 2, 3, 1, 2, 3, 0]).then((data) => {
console.info("SensorJsTest_077 failed") for (let i = 0; i < data.length; i++) {
console.info("SensorJsTest_077 failed")
expect(false).assertTrue();
}
done()
}, (error) => {
expect(false).assertTrue(); expect(false).assertTrue();
} console.info("SensorJsTest_077 success")
done() done()
}, (error) => { })
expect(true).assertTrue(); } catch (err) {
console.info("SensorJsTest_077 success") console.info('exception ' + JSON.stringify(err))
expect(err.code).assertEqual(PARAMETER_ERROR_CODE)
expect(err.message).assertEqual(PARAMETER_ERROR_MSG)
done() done()
}) }
}) })
let ANGLECHANGE_9_RESULT = [ let ANGLECHANGE_9_RESULT = [
...@@ -652,15 +662,22 @@ describe("SensorJsTest_sensor_1", function () { ...@@ -652,15 +662,22 @@ describe("SensorJsTest_sensor_1", function () {
*/ */
it('SensorJsTest_092', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it('SensorJsTest_092', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('SensorJsTest_092 start') console.info('SensorJsTest_092 start')
sensor.createQuaternion([0.25, 0.14], (error, data) => { try {
if (error) { sensor.createQuaternion([0.25, 0.14], (error, data) => {
console.info('SensorJsTest_092 failed'); if (error) {
expect(true).assertTrue(); console.info('SensorJsTest_092 failed');
} else { expect(false).assertTrue();
expect(false).assertTrue(); } else {
} expect(false).assertTrue();
}
done()
})
} catch (err) {
console.info('exception ' + JSON.stringify(err))
expect(err.code).assertEqual(PARAMETER_ERROR_CODE)
expect(err.message).assertEqual(PARAMETER_ERROR_MSG)
done() done()
}) }
console.info("SensorJsTest_092 end") console.info("SensorJsTest_092 end")
}) })
...@@ -693,15 +710,22 @@ describe("SensorJsTest_sensor_1", function () { ...@@ -693,15 +710,22 @@ describe("SensorJsTest_sensor_1", function () {
*/ */
it('SensorJsTest_094', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it('SensorJsTest_094', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('SensorJsTest_094 start') console.info('SensorJsTest_094 start')
sensor.createQuaternion([0, 0]).then((data) => { try {
console.info('SensorJsTest_094'); sensor.createQuaternion([0, 0]).then((data) => {
expect(false).assertTrue(); console.info('SensorJsTest_094');
done() expect(false).assertTrue();
}, (error) => { done()
expect(true).assertTrue(); }, (error) => {
console.info('promise failed') expect(false).assertTrue();
console.info('promise failed')
done()
})
} catch (err) {
console.info('exception ' + JSON.stringify(err))
expect(err.code).assertEqual(PARAMETER_ERROR_CODE)
expect(err.message).assertEqual(PARAMETER_ERROR_MSG)
done() done()
}) }
console.info("SensorJsTest_094 end") console.info("SensorJsTest_094 end")
}) })
...@@ -755,15 +779,22 @@ describe("SensorJsTest_sensor_1", function () { ...@@ -755,15 +779,22 @@ describe("SensorJsTest_sensor_1", function () {
*/ */
it('SensorJsTest_097', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it('SensorJsTest_097', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('SensorJsTest_097 start') console.info('SensorJsTest_097 start')
sensor.createQuaternion([0.25, 0.14]).then((data) => { try {
console.info('SensorJsTest_097'); sensor.createQuaternion([0.25, 0.14]).then((data) => {
expect(false).assertTrue(); console.info('SensorJsTest_097');
done() expect(false).assertTrue();
}, (error) => { done()
expect(true).assertTrue(); }, (error) => {
console.info('promise failed') expect(false).assertTrue();
console.info('promise failed')
done()
})
} catch (err) {
console.info('exception ' + JSON.stringify(err))
expect(err.code).assertEqual(PARAMETER_ERROR_CODE)
expect(err.message).assertEqual(PARAMETER_ERROR_MSG)
done() done()
}) }
}) })
let createRotationMatrixResult = [ let createRotationMatrixResult = [
...@@ -866,16 +897,23 @@ describe("SensorJsTest_sensor_1", function () { ...@@ -866,16 +897,23 @@ describe("SensorJsTest_sensor_1", function () {
*/ */
it('SensorJsTest_102', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { it('SensorJsTest_102', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) {
console.info('SensorJsTest_102 start') console.info('SensorJsTest_102 start')
sensor.getGeomagneticDip([1, 2, 3, 4], (error, data) => { try {
if (error) { sensor.getGeomagneticDip([1, 2, 3, 4], (error, data) => {
console.info('SensorJsTest_102 success'); if (error) {
expect(true).assertTrue(); console.info('SensorJsTest_102 success');
} else { expect(true).assertTrue();
console.info("SensorJsTest_102 failed") } else {
expect(false).assertTrue(); console.info("SensorJsTest_102 failed")
} expect(false).assertTrue();
}
done()
})
} catch (err) {
console.info('exception ' + JSON.stringify(err))
expect(err.code).assertEqual(PARAMETER_ERROR_CODE)
expect(err.message).assertEqual(PARAMETER_ERROR_MSG)
done() done()
}) }
console.info("SensorJsTest_102 end") console.info("SensorJsTest_102 end")
}) })
......
...@@ -37,10 +37,9 @@ describe('SystemParameterTest', function () { ...@@ -37,10 +37,9 @@ describe('SystemParameterTest', function () {
}) })
let testNullSensorId = -1; let testNullSensorId = -1;
let errMessages = ['SubscribeSensor failed'];
let errMessage; let errCode = 401
let errMessage = 'The parameter invalid.'
/** /**
* @tc.number SUB_SENSORS_Sensor_JSTest_0020 * @tc.number SUB_SENSORS_Sensor_JSTest_0020
...@@ -51,7 +50,7 @@ describe('SystemParameterTest', function () { ...@@ -51,7 +50,7 @@ describe('SystemParameterTest', function () {
console.info('testRegisterSensortest001 start'); console.info('testRegisterSensortest001 start');
function onSensorCallback(data) { function onSensorCallback(data) {
console.info('testRegisterSensortest001 on error'); console.info('testRegisterSensortest001 callback in');
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} }
...@@ -59,9 +58,9 @@ describe('SystemParameterTest', function () { ...@@ -59,9 +58,9 @@ describe('SystemParameterTest', function () {
try { try {
sensor.on(testNullSensorId, onSensorCallback); sensor.on(testNullSensorId, onSensorCallback);
} catch (error) { } catch (error) {
console.info('testRegisterSensortest001 error' +error); console.info('testRegisterSensortest001 error: ' + error.code + ' ,msg: ' + error.message);
errMessage = error.toString().slice(12, 34); expect(error.code).assertEqual(errCode)
expect(errMessage).assertEqual(errMessages[0]); expect(error.message).assertEqual(errMessage)
done(); done();
} }
console.info('testRegisterSensortest001 end'); console.info('testRegisterSensortest001 end');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册