1- import * as assert from "assert"
21import * as express from "express"
32import * as httpserver from "./httpserver"
43import * as integration from "./integration"
@@ -8,7 +7,7 @@ describe("proxy", () => {
87 const nhooyrDevServer = new httpserver . HttpServer ( )
98 let proxyPath : string
109
11- before ( async ( ) => {
10+ beforeAll ( async ( ) => {
1211 const e = express . default ( )
1312 await nhooyrDevServer . listen ( e )
1413 e . get ( "/wsup" , ( req , res ) => {
@@ -20,7 +19,7 @@ describe("proxy", () => {
2019 } )
2120 } )
2221
23- after ( async ( ) => {
22+ afterAll ( async ( ) => {
2423 await nhooyrDevServer . close ( )
2524 } )
2625
@@ -34,14 +33,16 @@ describe("proxy", () => {
3433 it ( "should rewrite the base path" , async ( ) => {
3534 ; [ , , codeServer ] = await integration . setup ( [ "--auth=none" ] , "" )
3635 const resp = await codeServer . fetch ( proxyPath )
37- assert . equal ( resp . status , 200 )
38- assert . equal ( await resp . json ( ) , "asher is the best" )
36+ expect ( resp . status ) . toBe ( 200 )
37+ const json = await resp . json ( )
38+ expect ( json ) . toBe ( "asher is the best" )
3939 } )
4040
4141 it ( "should not rewrite the base path" , async ( ) => {
4242 ; [ , , codeServer ] = await integration . setup ( [ "--auth=none" , "--proxy-path-passthrough=true" ] , "" )
4343 const resp = await codeServer . fetch ( proxyPath )
44- assert . equal ( resp . status , 200 )
45- assert . equal ( await resp . json ( ) , "joe is the best" )
44+ expect ( resp . status ) . toBe ( 200 )
45+ const json = await resp . json ( )
46+ expect ( json ) . toBe ( "joe is the best" )
4647 } )
4748} )
0 commit comments