未验证 提交 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,6 +285,7 @@ describe("SensorJsTest_sensor_1", function () { ...@@ -282,6 +285,7 @@ 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) {
try {
sensor.getDirection([1, 2, 3, 1, 2, 3, 1, 2, 3, 0]).then((data) => { sensor.getDirection([1, 2, 3, 1, 2, 3, 1, 2, 3, 0]).then((data) => {
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
console.info("SensorJsTest_077 failed") console.info("SensorJsTest_077 failed")
...@@ -289,10 +293,16 @@ describe("SensorJsTest_sensor_1", function () { ...@@ -289,10 +293,16 @@ describe("SensorJsTest_sensor_1", function () {
} }
done() done()
}, (error) => { }, (error) => {
expect(true).assertTrue(); expect(false).assertTrue();
console.info("SensorJsTest_077 success") console.info("SensorJsTest_077 success")
done() done()
}) })
} catch (err) {
console.info('exception ' + JSON.stringify(err))
expect(err.code).assertEqual(PARAMETER_ERROR_CODE)
expect(err.message).assertEqual(PARAMETER_ERROR_MSG)
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')
try {
sensor.createQuaternion([0.25, 0.14], (error, data) => { sensor.createQuaternion([0.25, 0.14], (error, data) => {
if (error) { if (error) {
console.info('SensorJsTest_092 failed'); console.info('SensorJsTest_092 failed');
expect(true).assertTrue(); expect(false).assertTrue();
} else { } else {
expect(false).assertTrue(); expect(false).assertTrue();
} }
done() done()
}) })
} catch (err) {
console.info('exception ' + JSON.stringify(err))
expect(err.code).assertEqual(PARAMETER_ERROR_CODE)
expect(err.message).assertEqual(PARAMETER_ERROR_MSG)
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')
try {
sensor.createQuaternion([0, 0]).then((data) => { sensor.createQuaternion([0, 0]).then((data) => {
console.info('SensorJsTest_094'); console.info('SensorJsTest_094');
expect(false).assertTrue(); expect(false).assertTrue();
done() done()
}, (error) => { }, (error) => {
expect(true).assertTrue(); expect(false).assertTrue();
console.info('promise failed') console.info('promise failed')
done() done()
}) })
} catch (err) {
console.info('exception ' + JSON.stringify(err))
expect(err.code).assertEqual(PARAMETER_ERROR_CODE)
expect(err.message).assertEqual(PARAMETER_ERROR_MSG)
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')
try {
sensor.createQuaternion([0.25, 0.14]).then((data) => { sensor.createQuaternion([0.25, 0.14]).then((data) => {
console.info('SensorJsTest_097'); console.info('SensorJsTest_097');
expect(false).assertTrue(); expect(false).assertTrue();
done() done()
}, (error) => { }, (error) => {
expect(true).assertTrue(); expect(false).assertTrue();
console.info('promise failed') console.info('promise failed')
done() done()
}) })
} catch (err) {
console.info('exception ' + JSON.stringify(err))
expect(err.code).assertEqual(PARAMETER_ERROR_CODE)
expect(err.message).assertEqual(PARAMETER_ERROR_MSG)
done()
}
}) })
let createRotationMatrixResult = [ let createRotationMatrixResult = [
...@@ -866,6 +897,7 @@ describe("SensorJsTest_sensor_1", function () { ...@@ -866,6 +897,7 @@ 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')
try {
sensor.getGeomagneticDip([1, 2, 3, 4], (error, data) => { sensor.getGeomagneticDip([1, 2, 3, 4], (error, data) => {
if (error) { if (error) {
console.info('SensorJsTest_102 success'); console.info('SensorJsTest_102 success');
...@@ -876,6 +908,12 @@ describe("SensorJsTest_sensor_1", function () { ...@@ -876,6 +908,12 @@ describe("SensorJsTest_sensor_1", function () {
} }
done() done()
}) })
} catch (err) {
console.info('exception ' + JSON.stringify(err))
expect(err.code).assertEqual(PARAMETER_ERROR_CODE)
expect(err.message).assertEqual(PARAMETER_ERROR_MSG)
done()
}
console.info("SensorJsTest_102 end") console.info("SensorJsTest_102 end")
}) })
......
...@@ -38,9 +38,8 @@ describe('SystemParameterTest', function () { ...@@ -38,9 +38,8 @@ describe('SystemParameterTest', function () {
let testNullSensorId = -1; let testNullSensorId = -1;
let errMessages = ['SubscribeSensor failed']; let errCode = 401
let errMessage = 'The parameter invalid.'
let errMessage;
/** /**
* @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.
先完成此消息的编辑!
想要评论请 注册