Skip to content

Commit 487c646

Browse files
committed
replace should with node:assert
1 parent 5cbc628 commit 487c646

File tree

10 files changed

+404
-395
lines changed

10 files changed

+404
-395
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ format:
77
./node_modules/.bin/biome check --fix
88

99
test:
10-
node --test --require should $(TEST_OPTS)
10+
node --test $(TEST_OPTS)
1111

1212
test-cov: TEST_OPTS := --experimental-test-coverage
1313
test-cov: test

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
"vis-why": "~2"
2727
},
2828
"devDependencies": {
29-
"@biomejs/biome": "^1.9.4",
30-
"should": "~13"
29+
"@biomejs/biome": "^1.9.4"
3130
},
3231
"scripts": {
3332
"test": "make check"

test/directions.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const { describe, it } = require('node:test');
2-
const should = require('should');
2+
const assert = require('node:assert/strict');
33
const furkotDirections = require('../lib/directions');
44
const { timeout } = require('../lib/service/util');
55

@@ -26,19 +26,19 @@ function timeService(millis, success = true) {
2626
describe('furkot-directions node module', async () => {
2727
await it('no input', async () => {
2828
const result = await furkotDirections()();
29-
should.not.exist(result);
29+
assert.strictEqual(result, undefined);
3030
});
3131

3232
await it('empty input', async () => {
3333
const result = await furkotDirections()({});
34-
should.not.exist(result);
34+
assert.strictEqual(result, undefined);
3535
});
3636

3737
await it('one point', async () => {
3838
const result = await furkotDirections()({
3939
points: [[0, 0]]
4040
});
41-
should.not.exist(result);
41+
assert.strictEqual(result, undefined);
4242
});
4343

4444
await it('no service', async () => {
@@ -50,8 +50,8 @@ describe('furkot-directions node module', async () => {
5050
[1, 1]
5151
]
5252
});
53-
should.exist(result);
54-
result.should.have.property('routes').with.length(1);
53+
assert.ok(result);
54+
assert.strictEqual(result.routes.length, 1);
5555
});
5656

5757
await it('service', async () => {
@@ -70,19 +70,19 @@ describe('furkot-directions node module', async () => {
7070
}
7171
]
7272
})(query);
73-
should.exist(result);
74-
result.should.have.property('stats', ['mock']);
75-
result.should.have.property('provider', 'mock');
76-
result.should.have.property('name', 'success');
77-
result.should.have.property('query', query);
73+
assert.ok(result);
74+
assert.deepStrictEqual(result.stats, ['mock']);
75+
assert.strictEqual(result.provider, 'mock');
76+
assert.strictEqual(result.name, 'success');
77+
assert.deepStrictEqual(result.query, query);
7878
});
7979

8080
await it('only enabled services', () => {
8181
const options = {
8282
valhalla_enable() {}
8383
};
8484
const directions = furkotDirections(options);
85-
directions.options.should.have.property('services').with.length(1);
85+
assert.strictEqual(directions.options.services.length, 1);
8686
});
8787

8888
await it('override provider name', () => {
@@ -92,7 +92,7 @@ describe('furkot-directions node module', async () => {
9292
stadiamaps_enable() {}
9393
};
9494
const directions = furkotDirections(options);
95-
directions.options.should.have.property('services').with.length(1);
95+
assert.strictEqual(directions.options.services.length, 1);
9696
});
9797

9898
await it('timeout', async () => {
@@ -110,7 +110,9 @@ describe('furkot-directions node module', async () => {
110110
[1, 1]
111111
]
112112
});
113-
await promise.should.be.resolvedWith({
113+
await assert.doesNotReject(promise);
114+
const result = await promise;
115+
assert.deepStrictEqual(result, {
114116
query: {
115117
points: [
116118
[0, 0],
@@ -151,6 +153,6 @@ describe('furkot-directions node module', async () => {
151153
);
152154
await timeout(15);
153155
ac.abort();
154-
await promise.should.be.rejectedWith(/aborted/);
156+
await assert.rejects(promise, /aborted/);
155157
});
156158
});

0 commit comments

Comments
 (0)