11'use strict'
22
3- const { test } = require ( 'tap ' )
3+ const { test } = require ( 'node:test ' )
44const fp = require ( '../plugin' )
55
6- test ( 'webpack removes require.main.filename' , ( t ) => {
6+ test ( 'webpack removes require.main.filename' , async ( t ) => {
77 const filename = require . main . filename
88 const info = console . info
9- t . teardown ( ( ) => {
9+ t . after ( ( ) => {
1010 require . main . filename = filename
1111 console . info = info
1212 } )
1313
1414 require . main . filename = null
1515
1616 console . info = function ( msg ) {
17- t . fail ( 'logged: ' + msg )
17+ t . assert . fail ( 'logged: ' + msg )
1818 }
1919
2020 fp ( ( fastify , opts , next ) => {
2121 next ( )
2222 } , {
2323 fastify : '^5.0.0'
2424 } )
25-
26- t . end ( )
2725} )
2826
29- test ( 'support faux modules' , ( t ) => {
27+ test ( 'support faux modules' , async ( t ) => {
3028 const plugin = fp ( ( fastify , opts , next ) => {
3129 next ( )
3230 } )
3331
34- t . equal ( plugin . default , plugin )
35- t . end ( )
32+ t . assert . strictEqual ( plugin . default , plugin )
3633} )
3734
3835test ( 'support faux modules does not override existing default field in babel module' , ( t ) => {
@@ -44,66 +41,65 @@ test('support faux modules does not override existing default field in babel mod
4441
4542 const plugin = fp ( module )
4643
47- t . equal ( plugin . default , 'Existing default field' )
48- t . end ( )
44+ t . assert . strictEqual ( plugin . default , 'Existing default field' )
4945} )
5046
51- test ( 'support ts named imports' , ( t ) => {
47+ test ( 'support ts named imports' , async ( t ) => {
5248 const plugin = fp ( ( fastify , opts , next ) => {
5349 next ( )
5450 } , {
5551 name : 'hello'
5652 } )
5753
58- t . equal ( plugin . hello , plugin )
59- t . end ( )
54+ t . assert . strictEqual ( plugin . hello , plugin )
55+
6056} )
6157
62- test ( 'from kebab-case to camelCase' , ( t ) => {
58+ test ( 'from kebab-case to camelCase' , async ( t ) => {
6359 const plugin = fp ( ( fastify , opts , next ) => {
6460 next ( )
6561 } , {
6662 name : 'hello-world'
6763 } )
6864
69- t . equal ( plugin . helloWorld , plugin )
70- t . end ( )
65+ t . assert . strictEqual ( plugin . helloWorld , plugin )
66+
7167} )
7268
73- test ( 'from @-prefixed named imports' , ( t ) => {
69+ test ( 'from @-prefixed named imports' , async ( t ) => {
7470 const plugin = fp ( ( fastify , opts , next ) => {
7571 next ( )
7672 } , {
7773 name : '@hello/world'
7874 } )
7975
80- t . equal ( plugin . helloWorld , plugin )
81- t . end ( )
76+ t . assert . strictEqual ( plugin . helloWorld , plugin )
77+
8278} )
8379
84- test ( 'from @-prefixed named kebab-case to camelCase' , ( t ) => {
80+ test ( 'from @-prefixed named kebab-case to camelCase' , async ( t ) => {
8581 const plugin = fp ( ( fastify , opts , next ) => {
8682 next ( )
8783 } , {
8884 name : '@hello/my-world'
8985 } )
9086
91- t . equal ( plugin . helloMyWorld , plugin )
92- t . end ( )
87+ t . assert . strictEqual ( plugin . helloMyWorld , plugin )
88+
9389} )
9490
95- test ( 'from kebab-case to camelCase multiple words' , ( t ) => {
91+ test ( 'from kebab-case to camelCase multiple words' , async ( t ) => {
9692 const plugin = fp ( ( fastify , opts , next ) => {
9793 next ( )
9894 } , {
9995 name : 'hello-long-world'
10096 } )
10197
102- t . equal ( plugin . helloLongWorld , plugin )
103- t . end ( )
98+ t . assert . strictEqual ( plugin . helloLongWorld , plugin )
99+
104100} )
105101
106- test ( 'from kebab-case to camelCase multiple words does not override' , ( t ) => {
102+ test ( 'from kebab-case to camelCase multiple words does not override' , async ( t ) => {
107103 const fn = ( fastify , opts , next ) => {
108104 next ( )
109105 }
@@ -115,6 +111,6 @@ test('from kebab-case to camelCase multiple words does not override', (t) => {
115111 name : 'hello-long-world'
116112 } )
117113
118- t . equal ( plugin . helloLongWorld , foobar )
119- t . end ( )
114+ t . assert . strictEqual ( plugin . helloLongWorld , foobar )
115+
120116} )
0 commit comments