Skip to content

Commit a78bcdf

Browse files
committed
Fix: correct bugs in test files
1 parent ba6f9a5 commit a78bcdf

6 files changed

Lines changed: 11 additions & 8 deletions

File tree

test/client_setup.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ rclnodejs
3737
rclnodejs.spin(node);
3838

3939
process.on('SIGINT', function () {
40-
timer.cancel();
4140
node.destroy();
4241
rclnodejs.shutdown();
4342
process.exit(0);

test/test-lifecycle.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@ describe('LifecycleNode test suite', function () {
260260
transitions[1].transition.id === 6
261261
); // shutdown
262262
assert.ok(
263-
transitions[1].transition.id === 2 || // cleanup
264-
transitions[1].transition.id === 3 || // activate
265-
transitions[1].transition.id === 6
263+
transitions[2].transition.id === 2 || // cleanup
264+
transitions[2].transition.id === 3 || // activate
265+
transitions[2].transition.id === 6
266266
); // shutdown
267267
});
268268

test/test-parameter-service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ describe('Parameter_server tests', function () {
251251

252252
// A.p3 value
253253
const p3 = Parameter.fromParameterMessage({
254-
name: 'p1',
254+
name: 'A.p3',
255255
value: response.values[1],
256256
});
257257
assert.equal(p3.type, ParameterType.PARAMETER_BOOL);

test/test-rate.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,12 @@ describe('rclnodejs rate test suite', function () {
107107
arr.reduce((prev, cur) => {
108108
return prev + cur;
109109
}, 0) / dataSize;
110+
111+
// avg sleep time should be within a reasonable range of the expected period
112+
const expectedPeriod = 1000 / hz; // 1ms
113+
assert.ok(
114+
avg < expectedPeriod * 5,
115+
`Average sleep time ${avg}ms exceeded 5x the expected period ${expectedPeriod}ms`
116+
);
110117
});
111118
});

test/test-utils.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ describe('Utils testing', function () {
4545
await utils.ensureDir(dir);
4646
});
4747

48-
it('should valid ensureDirSync works correctly', function () {});
49-
5048
it('should verify ensureDirSync works correctly', function () {
5149
const dir = path.join(tmpDir, 'nested/sync/dir');
5250
utils.ensureDirSync(dir);

test/types/index.test-d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@ const actionClient = new rclnodejs.ActionClient(
472472
expectType<rclnodejs.ActionClient<'example_interfaces/action/Fibonacci'>>(
473473
actionClient
474474
);
475-
expectType<boolean>(client.isServiceServerAvailable());
476475
expectType<Promise<boolean>>(actionClient.waitForServer());
477476
expectType<void>(actionClient.destroy());
478477

0 commit comments

Comments
 (0)