From 36a89f3e5a1cb8da8f21c3bed43eb9e828d1cd28 Mon Sep 17 00:00:00 2001 From: George Cheng Date: Tue, 26 Feb 2019 11:34:42 +0800 Subject: [PATCH] Refine test --- test.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test.js b/test.js index 52c1167..694428b 100644 --- a/test.js +++ b/test.js @@ -1,5 +1,5 @@ import test from 'ava' -import * as http from 'http' +import { createServer } from 'http' import axiosist from '.' test('should request', t => @@ -93,10 +93,9 @@ test('should response redirect', t => t.is(response.headers.location, 'http://example.com/') })) -test('should work with http server', t => { - const app = http.createServer((req, res) => { - res.end('foo') - }) - - return axiosist(app).get('/').then(() => t.pass()) -}) +test('should work with http server', t => + axiosist( + createServer((req, res) => res.end('foo')) + ).get('/').then(response => { + t.is(response.data, 'foo') + }))