File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 96
96
97
97
describe ( "unfriendMe" , function ( ) {
98
98
99
+ afterEach ( function ( ) {
100
+ return provider . removeInteractions ( )
101
+ } )
102
+
99
103
describe ( "when I have some friends" , function ( ) {
100
104
101
105
beforeAll ( function ( done ) {
139
143
state : 'I have no friends' ,
140
144
uponReceiving : 'a request to unfriend' ,
141
145
withRequest : {
142
- method : 'put ' ,
146
+ method : 'PUT ' ,
143
147
path : '/unfriendMe'
144
148
} ,
145
149
willRespondWith : {
146
- status : 404
150
+ status : 404 ,
151
+ body : { error : "No friends :(" }
147
152
}
148
153
} )
149
154
. then ( function ( ) { done ( ) } , function ( err ) { done . fail ( err ) } )
154
159
client . unfriendMe ( ) . then ( function ( ) {
155
160
done ( new Error ( 'expected request to /unfriend me to fail' ) )
156
161
} , function ( e ) {
162
+ expect ( e . status ) . toEqual ( 404 )
163
+ expect ( JSON . parse ( e . responseText ) . error ) . toEqual ( 'No friends :(' )
157
164
done ( )
158
165
} )
159
166
Original file line number Diff line number Diff line change 96
96
97
97
describe ( "unfriendMe" , function ( ) {
98
98
99
+ afterEach ( function ( ) {
100
+ return provider . removeInteractions ( )
101
+ } )
102
+
99
103
describe ( "when I have some friends" , function ( ) {
100
104
101
105
before ( function ( done ) {
139
143
state : 'I have no friends' ,
140
144
uponReceiving : 'a request to unfriend' ,
141
145
withRequest : {
142
- method : 'put ' ,
146
+ method : 'PUT ' ,
143
147
path : '/unfriendMe'
144
148
} ,
145
149
willRespondWith : {
146
- status : 404
150
+ status : 404 ,
151
+ body : { }
147
152
}
148
153
} )
149
154
. then ( function ( ) { done ( ) } , function ( err ) { done ( err ) } )
154
159
client . unfriendMe ( ) . then ( function ( ) {
155
160
done ( new Error ( 'expected request to /unfriend me to fail' ) )
156
161
} , function ( e ) {
162
+ expect ( e ) . to . eql ( 'No friends :(' )
157
163
done ( )
158
164
} )
159
165
You can’t perform that action at this time.
0 commit comments