@@ -3,7 +3,6 @@ import { createTestServer } from '../src';
33import { expect , test } from 'vitest'
44import * as querystring from 'querystring' ;
55import axios from 'axios' ;
6- import express from "express" ;
76
87test ( 'server instance exposes useful properties' , async ( ) => {
98 const server = await createTestServer ( ) ;
@@ -119,7 +118,7 @@ test('opts.bodyParser is passed through to bodyParser', async () => {
119118 const buf = Buffer . alloc ( 150 * 1024 ) ;
120119
121120 // Custom error handler so we don't dump the stack trace in the test output
122- smallServer . use ( ( _err : any , _req : any , res : any , _next : any ) => { // eslint-disable-line no-unused-vars
121+ smallServer . use ( ( _err : any , _req : any , res : any , _next : any ) => {
123122 res . status ( 500 ) . end ( ) ;
124123 } ) ;
125124
@@ -134,15 +133,13 @@ test('opts.bodyParser is passed through to bodyParser', async () => {
134133 } ) ;
135134
136135 // TODO: Rewrite
137- // await t.throws(got.post(smallServer.url, {
138- // headers: { 'content-type': 'application/octet-stream' },
139- // body: buf
140- // }));
141-
142- // await t.notThrows(got.post(bigServer.url, {
143- // headers: { 'content-type': 'application/octet-stream' },
144- // body: buf
145- // }));
136+ await expect ( axios . post ( smallServer . url ! , buf , {
137+ headers : { 'content-type' : 'application/octet-stream' } ,
138+ } ) ) . rejects . toThrow ( "500" )
139+
140+ await expect ( axios . post ( bigServer . url ! , buf , {
141+ headers : { 'content-type' : 'application/octet-stream' } ,
142+ } ) ) . resolves . toMatchObject ( { status : 200 } ) ;
146143} ) ;
147144
148145test ( 'if opts.bodyParser is false body parsing middleware is disabled' , async ( ) => {
0 commit comments