Skip to content

Commit 74f0abe

Browse files
liuhanquhanquliu
and
hanquliu
authoredMar 25, 2025··
test: migrated chainable.js from tap to node:test (#285)
Co-authored-by: hanquliu <[email protected]>
1 parent 72a00cf commit 74f0abe

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed
 

‎test/chainable.test.js

+23-20
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,48 @@
11
'use strict'
22

3-
const { test } = require('tap')
3+
const { test } = require('node:test')
44
const boot = require('..')
55

6-
test('chainable standalone', (t) => {
6+
test('chainable standalone', (t, testDone) => {
77
t.plan(5)
88

99
const readyResult = boot()
1010
.use(function (ctx, opts, done) {
11-
t.pass('1st plugin')
11+
t.assert.ok('1st plugin')
1212
done()
1313
}).after(function (err, done) {
14-
t.error(err)
15-
t.pass('2nd after')
14+
t.assert.ifError(err)
15+
t.assert.ok('2nd after')
1616
done()
1717
}).ready(function () {
18-
t.pass('we are ready')
18+
t.assert.ok('we are ready')
19+
testDone()
1920
})
20-
t.equal(readyResult, undefined)
21+
t.assert.strictEqual(readyResult, undefined)
2122
})
2223

23-
test('chainable automatically binded', (t) => {
24+
test('chainable automatically binded', (t, testDone) => {
2425
t.plan(5)
2526

2627
const app = {}
2728
boot(app)
2829

2930
const readyResult = app
3031
.use(function (ctx, opts, done) {
31-
t.pass('1st plugin')
32+
t.assert.ok('1st plugin')
3233
done()
3334
}).after(function (err, done) {
34-
t.error(err)
35-
t.pass('2nd after')
35+
t.assert.ifError(err)
36+
t.assert.ok('2nd after')
3637
done()
3738
}).ready(function () {
38-
t.pass('we are ready')
39+
t.assert.ok('we are ready')
40+
testDone()
3941
})
40-
t.equal(readyResult, undefined)
42+
t.assert.strictEqual(readyResult, undefined)
4143
})
4244

43-
test('chainable standalone with server', (t) => {
45+
test('chainable standalone with server', (t, testDone) => {
4446
t.plan(6)
4547

4648
const server = {}
@@ -51,17 +53,18 @@ test('chainable standalone with server', (t) => {
5153
})
5254

5355
const readyResult = server.register(function (ctx, opts, done) {
54-
t.pass('1st plugin')
56+
t.assert.ok('1st plugin')
5557
done()
5658
}).after(function (err, done) {
57-
t.error(err)
58-
t.pass('2nd after')
59+
t.assert.ifError(err)
60+
t.assert.ok('2nd after')
5961
done()
6062
}).register(function (ctx, opts, done) {
61-
t.pass('3rd plugin')
63+
t.assert.ok('3rd plugin')
6264
done()
6365
}).ready(function () {
64-
t.pass('we are ready')
66+
t.assert.ok('we are ready')
67+
testDone()
6568
})
66-
t.equal(readyResult, undefined)
69+
t.assert.strictEqual(readyResult, undefined)
6770
})

0 commit comments

Comments
 (0)
Please sign in to comment.