11// LICENSE : MIT
22"use strict" ;
33import assert from "power-assert" ;
4- import connect from "connect"
4+ import connect from "connect" ;
55import nosniff from "../../src/connect/nosniff" ;
66import hello from "../../src/connect/hello" ;
77import http from "http" ;
88import fetch from "node-fetch" ;
9- describe ( "hello " , function ( ) {
9+ describe ( "connect " , function ( ) {
1010 var responseText = "test" ;
1111 var server ;
1212 before ( function ( done ) {
@@ -18,17 +18,21 @@ describe("hello", function () {
1818 after ( function ( ) {
1919 server . close ( ) ;
2020 } ) ;
21- it ( "should return response text" , function ( ) {
22- return fetch ( "http://localhost:3000" )
23- . then ( res => res . text ( ) )
24- . then ( text => {
25- assert . equal ( text , responseText ) ;
26- } ) ;
21+ describe ( "hello" , function ( ) {
22+ it ( "should return response text" , function ( ) {
23+ return fetch ( "http://localhost:3000" )
24+ . then ( res => res . text ( ) )
25+ . then ( text => {
26+ assert . equal ( text , responseText ) ;
27+ } ) ;
28+ } ) ;
2729 } ) ;
28- it ( "should return response has `X-Content-Type-Options` header" , function ( ) {
29- return fetch ( "http://localhost:3000" )
30- . then ( res => {
31- assert . equal ( res . headers . get ( "x-content-type-options" ) , "nosniff" ) ;
32- } )
30+ describe ( "sniff" , function ( ) {
31+ it ( "should return response has `X-Content-Type-Options` header" , function ( ) {
32+ return fetch ( "http://localhost:3000" )
33+ . then ( res => {
34+ assert . equal ( res . headers . get ( "x-content-type-options" ) , "nosniff" ) ;
35+ } ) ;
36+ } ) ;
3337 } ) ;
3438} ) ;
0 commit comments