@@ -15,46 +15,55 @@ function testResponse(assertion, response) {
15
15
res . json ( response ) ;
16
16
} ) ;
17
17
18
- request ( app ) . post ( '/' ) . expect ( 200 ) . end ( ) ;
18
+ request ( app )
19
+ . post ( '/' )
20
+ . expect ( 200 )
21
+ . end ( ) ;
19
22
}
20
23
21
24
describe ( 'processResponse()' , ( ) => {
22
25
describe . skip ( 'options' , ( ) => {
23
- it ( 'should strip blacklisted properties' , ( done ) => {
24
- testResponse ( ( res ) => {
25
- assert . deepEqual (
26
- processResponse ( res , { blacklist : [ 'password' , 'apiKey' ] } ) . content . text ,
27
- JSON . stringify ( { another : 'Hello world' } ) ,
28
- ) ;
29
- return done ( ) ;
30
- } , { password : '123456' , apiKey : 'abcdef' , another : 'Hello world' } ) ;
26
+ it ( 'should strip blacklisted properties' , done => {
27
+ testResponse (
28
+ res => {
29
+ assert . deepEqual (
30
+ processResponse ( res , { blacklist : [ 'password' , 'apiKey' ] } ) . content . text ,
31
+ JSON . stringify ( { another : 'Hello world' } ) ,
32
+ ) ;
33
+ return done ( ) ;
34
+ } ,
35
+ { password : '123456' , apiKey : 'abcdef' , another : 'Hello world' } ,
36
+ ) ;
31
37
} ) ;
32
38
33
- it ( 'should only send whitelisted properties' , ( done ) => {
34
- testResponse ( ( res ) => {
35
- assert . deepEqual (
36
- processResponse ( res , { whitelist : [ 'password' , 'apiKey' ] } ) . content . text ,
37
- JSON . stringify ( { password : '123456' , apiKey : 'abcdef' } ) ,
38
- ) ;
39
- return done ( ) ;
40
- } , { password : '123456' , apiKey : 'abcdef' , another : 'Hello world' } ) ;
39
+ it ( 'should only send whitelisted properties' , done => {
40
+ testResponse (
41
+ res => {
42
+ assert . deepEqual (
43
+ processResponse ( res , { whitelist : [ 'password' , 'apiKey' ] } ) . content . text ,
44
+ JSON . stringify ( { password : '123456' , apiKey : 'abcdef' } ) ,
45
+ ) ;
46
+ return done ( ) ;
47
+ } ,
48
+ { password : '123456' , apiKey : 'abcdef' , another : 'Hello world' } ,
49
+ ) ;
41
50
} ) ;
42
51
} ) ;
43
52
44
- it ( '#status' , ( done ) =>
45
- testResponse ( ( res ) => {
53
+ it ( '#status' , done =>
54
+ testResponse ( res => {
46
55
assert . equal ( processResponse ( res ) . status , 200 ) ;
47
56
return done ( ) ;
48
57
} ) ) ;
49
58
50
- it ( '#statusText' , ( done ) =>
51
- testResponse ( ( res ) => {
59
+ it ( '#statusText' , done =>
60
+ testResponse ( res => {
52
61
assert . equal ( processResponse ( res ) . statusText , 'OK' ) ;
53
62
return done ( ) ;
54
63
} ) ) ;
55
64
56
- it ( '#headers' , ( done ) => {
57
- testResponse ( ( res ) => {
65
+ it ( '#headers' , done => {
66
+ testResponse ( res => {
58
67
assert . deepEqual ( processResponse ( res ) . headers . filter ( header => header . name !== 'date' ) , [
59
68
{ name : 'x-powered-by' , value : 'Express' } ,
60
69
{
@@ -67,26 +76,23 @@ describe('processResponse()', () => {
67
76
} ) ;
68
77
69
78
describe ( '#content' , ( ) => {
70
- it ( '#size' , ( done ) => {
79
+ it ( '#size' , done => {
71
80
const body = { a : 1 , b : 2 , c : 3 } ;
72
- testResponse ( ( res ) => {
81
+ testResponse ( res => {
73
82
assert . deepEqual ( processResponse ( res ) . content . size , JSON . stringify ( body ) . length ) ;
74
83
return done ( ) ;
75
84
} , body ) ;
76
85
} ) ;
77
86
78
- it ( '#mimeType' , ( done ) =>
79
- testResponse ( ( res ) => {
80
- assert . deepEqual (
81
- processResponse ( res ) . content . mimeType ,
82
- 'application/json; charset=utf-8' ,
83
- ) ;
87
+ it ( '#mimeType' , done =>
88
+ testResponse ( res => {
89
+ assert . deepEqual ( processResponse ( res ) . content . mimeType , 'application/json; charset=utf-8' ) ;
84
90
return done ( ) ;
85
91
} ) ) ;
86
92
87
- it . skip ( '#text' , ( done ) => {
93
+ it . skip ( '#text' , done => {
88
94
const body = { a : 1 , b : 2 , c : 3 } ;
89
- testResponse ( ( res ) => {
95
+ testResponse ( res => {
90
96
assert . deepEqual ( processResponse ( res ) . content . text , JSON . stringify ( body ) ) ;
91
97
return done ( ) ;
92
98
} , body ) ;
0 commit comments