1- import test from 'ava' ;
1+ import test from 'node:test' ;
2+ import { strict as assert } from 'node:assert' ;
23
34import * as t from 'io-ts' ;
45import express from 'express' ;
@@ -101,7 +102,7 @@ const GetHelloWorld = async (params: { id: string }) =>
101102 payload : params ,
102103 } as const ) ;
103104
104- test ( 'should offer a delightful developer experience' , async ( t ) => {
105+ test ( 'should offer a delightful developer experience' , async ( ) => {
105106 const app = createServer ( ApiSpec , ( app : express . Application ) => {
106107 // Configure app-level middleware
107108 app . use ( express . json ( ) ) ;
@@ -128,10 +129,10 @@ test('should offer a delightful developer experience', async (t) => {
128129 . decodeExpecting ( 200 )
129130 . then ( ( res ) => res . body ) ;
130131
131- t . like ( response , { message : "Who's there?" } ) ;
132+ assert . equal ( response . message , "Who's there?" ) ;
132133} ) ;
133134
134- test ( 'should handle io-ts-http formatted path parameters' , async ( t ) => {
135+ test ( 'should handle io-ts-http formatted path parameters' , async ( ) => {
135136 const app = createServer ( ApiSpec , ( app : express . Application ) => {
136137 app . use ( express . json ( ) ) ;
137138 app . use ( appMiddleware ) ;
@@ -151,10 +152,10 @@ test('should handle io-ts-http formatted path parameters', async (t) => {
151152 . decodeExpecting ( 200 )
152153 . then ( ( res ) => res . body ) ;
153154
154- t . like ( response , { id : '1337' } ) ;
155+ assert . equal ( response . id , '1337' ) ;
155156} ) ;
156157
157- test ( 'should invoke app-level middleware' , async ( t ) => {
158+ test ( 'should invoke app-level middleware' , async ( ) => {
158159 const app = createServer ( ApiSpec , ( app : express . Application ) => {
159160 // Configure app-level middleware
160161 app . use ( express . json ( ) ) ;
@@ -175,10 +176,11 @@ test('should invoke app-level middleware', async (t) => {
175176 . decodeExpecting ( 200 )
176177 . then ( ( res ) => res . body ) ;
177178
178- t . like ( response , { message : "Who's there?" , appMiddlewareRan : true } ) ;
179+ assert . equal ( response . message , "Who's there?" ) ;
180+ assert . equal ( response . appMiddlewareRan , true ) ;
179181} ) ;
180182
181- test ( 'should invoke route-level middleware' , async ( t ) => {
183+ test ( 'should invoke route-level middleware' , async ( ) => {
182184 const app = createServer ( ApiSpec , ( app : express . Application ) => {
183185 // Configure app-level middleware
184186 app . use ( express . json ( ) ) ;
@@ -198,10 +200,11 @@ test('should invoke route-level middleware', async (t) => {
198200 . decodeExpecting ( 200 )
199201 . then ( ( res ) => res . body ) ;
200202
201- t . like ( response , { message : "Who's there?" , routeMiddlewareRan : true } ) ;
203+ assert . equal ( response . message , "Who's there?" ) ;
204+ assert . equal ( response . routeMiddlewareRan , true ) ;
202205} ) ;
203206
204- test ( 'should not add parameters from middleware unless routeHandler() is used' , async ( t ) => {
207+ test ( 'should not add parameters from middleware unless routeHandler() is used' , async ( ) => {
205208 const app = createServer ( ApiSpec , ( app : express . Application ) => {
206209 // Configure app-level middleware
207210 app . use ( express . json ( ) ) ;
@@ -221,10 +224,11 @@ test('should not add parameters from middleware unless routeHandler() is used',
221224 . decodeExpecting ( 200 )
222225 . then ( ( res ) => res . body ) ;
223226
224- t . like ( response , { message : "Who's there?" , routeMiddlewareRan : false } ) ;
227+ assert . equal ( response . message , "Who's there?" ) ;
228+ assert . equal ( response . routeMiddlewareRan , false ) ;
225229} ) ;
226230
227- test ( 'should infer status code from response type' , async ( t ) => {
231+ test ( 'should infer status code from response type' , async ( ) => {
228232 const app = createServer ( ApiSpec , ( app : express . Application ) => {
229233 // Configure app-level middleware
230234 app . use ( express . json ( ) ) ;
@@ -244,10 +248,10 @@ test('should infer status code from response type', async (t) => {
244248 . decodeExpecting ( 400 )
245249 . then ( ( res ) => res . body ) ;
246250
247- t . like ( response , { errors : 'Please do not tell me zero! I will now explode' } ) ;
251+ assert . equal ( response . errors , 'Please do not tell me zero! I will now explode' ) ;
248252} ) ;
249253
250- test ( 'should return a 400 when request fails to decode' , async ( t ) => {
254+ test ( 'should return a 400 when request fails to decode' , async ( ) => {
251255 const app = createServer ( ApiSpec , ( app : express . Application ) => {
252256 // Configure app-level middleware
253257 app . use ( express . json ( ) ) ;
@@ -264,5 +268,5 @@ test('should return a 400 when request fails to decode', async (t) => {
264268 . set ( 'Content-Type' , 'application/json' )
265269 . expect ( 400 ) ;
266270
267- t . true ( response . body . error . startsWith ( 'Invalid value undefined supplied to' ) ) ;
271+ assert ( response . body . error . startsWith ( 'Invalid value undefined supplied to' ) ) ;
268272} ) ;
0 commit comments