File tree Expand file tree Collapse file tree 2 files changed +19
-12
lines changed
Expand file tree Collapse file tree 2 files changed +19
-12
lines changed Original file line number Diff line number Diff line change 11// LICENSE : MIT
22"use strict" ;
33export default function ( text ) {
4- return function ( req , res , next ) {
5- res . end ( text + "\n" ) ;
4+ return function ( req , res ) {
5+ res . end ( text ) ;
66 } ;
77}
Original file line number Diff line number Diff line change 11// LICENSE : MIT
22"use strict" ;
3- var assert = require ( "power-assert" ) ;
3+ import assert from "power-assert" ;
44import connect from "connect"
55import hello from "../../src/connect/hello" ;
6-
6+ import http from "http" ;
7+ import fetch from "node-fetch" ;
78describe ( "hello" , function ( ) {
8- before ( function ( ) {
9- var connect = require ( 'connect' ) ;
10- var http = require ( 'http' ) ;
9+ var responseText = "test" ;
10+ var server ;
11+ before ( function ( done ) {
1112 var app = connect ( ) ;
12- app . use ( hello ( "test" ) ) ;
13- http . createServer ( app ) . listen ( 3000 , done ) ;
13+ app . use ( hello ( responseText ) ) ;
14+ server = http . createServer ( app ) . listen ( 3000 , done ) ;
1415 } ) ;
15- after ( function ( done ) {
16+ after ( function ( ) {
17+ server . close ( ) ;
18+ } ) ;
19+ it ( "should return response text" , function ( ) {
20+ return fetch ( "http://localhost:3000" )
21+ . then ( res => res . text ( ) )
22+ . then ( text => {
23+ assert . equal ( text ,
24+ } ) ;
1625 } ) ;
17- it ( "should return test" , function ( )
18- ) ;
1926} ) ;
You can’t perform that action at this time.
0 commit comments