11'use strict'
22
3- const t = require ( 'tap' )
3+ const { tspl } = require ( '@matteo.collina/tspl' )
4+ const { test } = require ( 'node:test' )
45const { pipeline : undiciPipeline } = require ( '..' )
56const { pipeline : streamPipelineCb } = require ( 'node:stream' )
67const { promisify } = require ( 'node:util' )
@@ -9,42 +10,42 @@ const { startRedirectingServer } = require('./utils/redirecting-servers')
910
1011const streamPipeline = promisify ( streamPipelineCb )
1112
12- t . test ( 'should not follow redirection by default if not using RedirectAgent' , async t => {
13- t . plan ( 3 )
13+ test ( 'should not follow redirection by default if not using RedirectAgent' , async t => {
14+ t = tspl ( t , { plan : 3 } )
1415
1516 const body = [ ]
16- const serverRoot = await startRedirectingServer ( t )
17+ const serverRoot = await startRedirectingServer ( )
1718
1819 await streamPipeline (
1920 createReadable ( 'REQUEST' ) ,
2021 undiciPipeline ( `http://${ serverRoot } /` , { } , ( { statusCode, headers, body } ) => {
21- t . equal ( statusCode , 302 )
22- t . equal ( headers . location , `http://${ serverRoot } /302/1` )
22+ t . strictEqual ( statusCode , 302 )
23+ t . strictEqual ( headers . location , `http://${ serverRoot } /302/1` )
2324
2425 return body
2526 } ) ,
2627 createWritable ( body )
2728 )
2829
29- t . equal ( body . length , 0 )
30+ t . strictEqual ( body . length , 0 )
3031} )
3132
32- t . test ( 'should not follow redirects when using RedirectAgent within pipeline' , async t => {
33- t . plan ( 3 )
33+ test ( 'should not follow redirects when using RedirectAgent within pipeline' , async t => {
34+ t = tspl ( t , { plan : 3 } )
3435
3536 const body = [ ]
36- const serverRoot = await startRedirectingServer ( t )
37+ const serverRoot = await startRedirectingServer ( )
3738
3839 await streamPipeline (
3940 createReadable ( 'REQUEST' ) ,
4041 undiciPipeline ( `http://${ serverRoot } /` , { maxRedirections : 1 } , ( { statusCode, headers, body } ) => {
41- t . equal ( statusCode , 302 )
42- t . equal ( headers . location , `http://${ serverRoot } /302/1` )
42+ t . strictEqual ( statusCode , 302 )
43+ t . strictEqual ( headers . location , `http://${ serverRoot } /302/1` )
4344
4445 return body
4546 } ) ,
4647 createWritable ( body )
4748 )
4849
49- t . equal ( body . length , 0 )
50+ t . strictEqual ( body . length , 0 )
5051} )
0 commit comments