diff --git a/test/client_setup.js b/test/client_setup.js index 03eb2deb..9d190d25 100644 --- a/test/client_setup.js +++ b/test/client_setup.js @@ -37,7 +37,6 @@ rclnodejs rclnodejs.spin(node); process.on('SIGINT', function () { - timer.cancel(); node.destroy(); rclnodejs.shutdown(); process.exit(0); diff --git a/test/test-lifecycle.js b/test/test-lifecycle.js index b628ad3d..821af905 100644 --- a/test/test-lifecycle.js +++ b/test/test-lifecycle.js @@ -260,9 +260,9 @@ describe('LifecycleNode test suite', function () { transitions[1].transition.id === 6 ); // shutdown assert.ok( - transitions[1].transition.id === 2 || // cleanup - transitions[1].transition.id === 3 || // activate - transitions[1].transition.id === 6 + transitions[2].transition.id === 2 || // cleanup + transitions[2].transition.id === 3 || // activate + transitions[2].transition.id === 6 ); // shutdown }); diff --git a/test/test-parameter-service.js b/test/test-parameter-service.js index d733140e..4d405bff 100644 --- a/test/test-parameter-service.js +++ b/test/test-parameter-service.js @@ -251,7 +251,7 @@ describe('Parameter_server tests', function () { // A.p3 value const p3 = Parameter.fromParameterMessage({ - name: 'p1', + name: 'A.p3', value: response.values[1], }); assert.equal(p3.type, ParameterType.PARAMETER_BOOL); diff --git a/test/test-rate.js b/test/test-rate.js index 41353536..092c3a38 100644 --- a/test/test-rate.js +++ b/test/test-rate.js @@ -107,5 +107,12 @@ describe('rclnodejs rate test suite', function () { arr.reduce((prev, cur) => { return prev + cur; }, 0) / dataSize; + + // avg sleep time should be within a reasonable range of the expected period + const expectedPeriod = 1000 / hz; // 1ms + assert.ok( + avg < expectedPeriod * 5, + `Average sleep time ${avg}ms exceeded 5x the expected period ${expectedPeriod}ms` + ); }); }); diff --git a/test/test-utils.js b/test/test-utils.js index beb357ce..1d685ad8 100644 --- a/test/test-utils.js +++ b/test/test-utils.js @@ -45,8 +45,6 @@ describe('Utils testing', function () { await utils.ensureDir(dir); }); - it('should valid ensureDirSync works correctly', function () {}); - it('should verify ensureDirSync works correctly', function () { const dir = path.join(tmpDir, 'nested/sync/dir'); utils.ensureDirSync(dir); diff --git a/test/types/index.test-d.ts b/test/types/index.test-d.ts index 4378d208..7147b811 100644 --- a/test/types/index.test-d.ts +++ b/test/types/index.test-d.ts @@ -472,7 +472,6 @@ const actionClient = new rclnodejs.ActionClient( expectType>( actionClient ); -expectType(client.isServiceServerAvailable()); expectType>(actionClient.waitForServer()); expectType(actionClient.destroy());