1
1
'use strict'
2
2
3
- const { test } = require ( 'tap ' )
3
+ const { test } = require ( 'node:test ' )
4
4
const boot = require ( '..' )
5
5
6
- test ( 'chainable standalone' , ( t ) => {
6
+ test ( 'chainable standalone' , ( t , testDone ) => {
7
7
t . plan ( 5 )
8
8
9
9
const readyResult = boot ( )
10
10
. use ( function ( ctx , opts , done ) {
11
- t . pass ( '1st plugin' )
11
+ t . assert . ok ( '1st plugin' )
12
12
done ( )
13
13
} ) . after ( function ( err , done ) {
14
- t . error ( err )
15
- t . pass ( '2nd after' )
14
+ t . assert . ifError ( err )
15
+ t . assert . ok ( '2nd after' )
16
16
done ( )
17
17
} ) . ready ( function ( ) {
18
- t . pass ( 'we are ready' )
18
+ t . assert . ok ( 'we are ready' )
19
+ testDone ( )
19
20
} )
20
- t . equal ( readyResult , undefined )
21
+ t . assert . strictEqual ( readyResult , undefined )
21
22
} )
22
23
23
- test ( 'chainable automatically binded' , ( t ) => {
24
+ test ( 'chainable automatically binded' , ( t , testDone ) => {
24
25
t . plan ( 5 )
25
26
26
27
const app = { }
27
28
boot ( app )
28
29
29
30
const readyResult = app
30
31
. use ( function ( ctx , opts , done ) {
31
- t . pass ( '1st plugin' )
32
+ t . assert . ok ( '1st plugin' )
32
33
done ( )
33
34
} ) . after ( function ( err , done ) {
34
- t . error ( err )
35
- t . pass ( '2nd after' )
35
+ t . assert . ifError ( err )
36
+ t . assert . ok ( '2nd after' )
36
37
done ( )
37
38
} ) . ready ( function ( ) {
38
- t . pass ( 'we are ready' )
39
+ t . assert . ok ( 'we are ready' )
40
+ testDone ( )
39
41
} )
40
- t . equal ( readyResult , undefined )
42
+ t . assert . strictEqual ( readyResult , undefined )
41
43
} )
42
44
43
- test ( 'chainable standalone with server' , ( t ) => {
45
+ test ( 'chainable standalone with server' , ( t , testDone ) => {
44
46
t . plan ( 6 )
45
47
46
48
const server = { }
@@ -51,17 +53,18 @@ test('chainable standalone with server', (t) => {
51
53
} )
52
54
53
55
const readyResult = server . register ( function ( ctx , opts , done ) {
54
- t . pass ( '1st plugin' )
56
+ t . assert . ok ( '1st plugin' )
55
57
done ( )
56
58
} ) . after ( function ( err , done ) {
57
- t . error ( err )
58
- t . pass ( '2nd after' )
59
+ t . assert . ifError ( err )
60
+ t . assert . ok ( '2nd after' )
59
61
done ( )
60
62
} ) . register ( function ( ctx , opts , done ) {
61
- t . pass ( '3rd plugin' )
63
+ t . assert . ok ( '3rd plugin' )
62
64
done ( )
63
65
} ) . ready ( function ( ) {
64
- t . pass ( 'we are ready' )
66
+ t . assert . ok ( 'we are ready' )
67
+ testDone ( )
65
68
} )
66
- t . equal ( readyResult , undefined )
69
+ t . assert . strictEqual ( readyResult , undefined )
67
70
} )
0 commit comments