1
- import * as assert from "assert"
2
1
import * as express from "express"
3
2
import * as httpserver from "./httpserver"
4
3
import * as integration from "./integration"
@@ -8,7 +7,7 @@ describe("proxy", () => {
8
7
const nhooyrDevServer = new httpserver . HttpServer ( )
9
8
let proxyPath : string
10
9
11
- before ( async ( ) => {
10
+ beforeAll ( async ( ) => {
12
11
const e = express . default ( )
13
12
await nhooyrDevServer . listen ( e )
14
13
e . get ( "/wsup" , ( req , res ) => {
@@ -20,7 +19,7 @@ describe("proxy", () => {
20
19
} )
21
20
} )
22
21
23
- after ( async ( ) => {
22
+ afterAll ( async ( ) => {
24
23
await nhooyrDevServer . close ( )
25
24
} )
26
25
@@ -34,14 +33,16 @@ describe("proxy", () => {
34
33
it ( "should rewrite the base path" , async ( ) => {
35
34
; [ , , codeServer ] = await integration . setup ( [ "--auth=none" ] , "" )
36
35
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" )
39
39
} )
40
40
41
41
it ( "should not rewrite the base path" , async ( ) => {
42
42
; [ , , codeServer ] = await integration . setup ( [ "--auth=none" , "--proxy-path-passthrough=true" ] , "" )
43
43
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" )
46
47
} )
47
48
} )
0 commit comments