@@ -150,7 +150,10 @@ describe('POST /api/v1/streams/:streamId/withdraw', () => {
150150 . set ( 'Authorization' , `Bearer ${ token } ` ) ;
151151
152152 expect ( response . status ) . toBe ( 403 ) ;
153- expect ( response . body . error ) . toBe ( 'Forbidden' ) ;
153+ expect ( response . body . error ) . toMatchObject ( {
154+ code : 'FORBIDDEN' ,
155+ message : 'Only the stream recipient can withdraw from the stream' ,
156+ } ) ;
154157 } ) ;
155158
156159 it ( 'returns 404 if stream not found' , async ( ) => {
@@ -164,7 +167,10 @@ describe('POST /api/v1/streams/:streamId/withdraw', () => {
164167 . set ( 'Authorization' , `Bearer ${ token } ` ) ;
165168
166169 expect ( response . status ) . toBe ( 404 ) ;
167- expect ( response . body . error ) . toBe ( 'Stream not found' ) ;
170+ expect ( response . body . error ) . toMatchObject ( {
171+ code : 'NOT_FOUND' ,
172+ message : 'Stream not found' ,
173+ } ) ;
168174 } ) ;
169175
170176 it ( 'returns 409 if no claimable balance available' , async ( ) => {
@@ -192,7 +198,7 @@ describe('POST /api/v1/streams/:streamId/withdraw', () => {
192198 . set ( 'Authorization' , `Bearer ${ token } ` ) ;
193199
194200 expect ( response . status ) . toBe ( 409 ) ;
195- expect ( response . body . message ) . toBe ( 'No claimable balance is currently available' ) ;
201+ expect ( response . body . error . message ) . toBe ( 'No claimable balance is currently available' ) ;
196202 } ) ;
197203
198204 it ( 'does not double-count withdrawnAmount when the same claim window is withdrawn twice in a row' , async ( ) => {
@@ -291,7 +297,7 @@ describe('POST /api/v1/streams/:streamId/withdraw', () => {
291297 // lastUpdateTime, so the second call correctly finds nothing left to
292298 // claim in this window and is rejected.
293299 expect ( second . status ) . toBe ( 409 ) ;
294- expect ( second . body . message ) . toBe ( 'No claimable balance is currently available' ) ;
300+ expect ( second . body . error . message ) . toBe ( 'No claimable balance is currently available' ) ;
295301 }
296302
297303 // The critical assertion: withdrawnAmount reflects only the ONE
0 commit comments