@@ -260,13 +260,15 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
260260 } );
261261
262262 it ( " handles async future failures and returns mixed results" , function () {
263+ variables .fakeInvocationCount = 0 ;
263264 variables .hyper
264265 .fake ( {
265266 " /v2/contacts" : function ( newFakeResponse , req ) {
266- return [
267- newFakeResponse ( 500 , " Internal Server Error" , " {}" ),
268- newFakeResponse ( 201 , " Created" , " {}" )
269- ];
267+ variables .fakeInvocationCount ++ ;
268+ if ( variables .fakeInvocationCount == 1 ) {
269+ throw ( type = " AsyncFutureBoom" , message = " Boom from fake response callback" );
270+ }
271+ return newFakeResponse ( 201 , " Created" , " {}" );
270272 }
271273 } )
272274 .preventStrayRequests ();
@@ -285,15 +287,15 @@ component extends="tests.resources.ModuleIntegrationSpec" appMapping="/app" {
285287 return ! item .success ;
286288 } );
287289 expect ( failedResults ).toHaveLength ( 1 );
288- expect ( failedResults [ 1 ].statusCode ).toBe ( 500 );
289- expect ( failedResults [ 1 ].error ).toInclude ( " Internal Server Error " );
290- expect (
291- result . results
292- . map ( function ( item ) {
293- return item . subscriber ;
294- } )
295- . sort ( " textnocase" )
296- ). toBe ( [ " explode@example.com " , " ok@example.com " ]. sort ( " textnocase " ) );
290+ expect ( failedResults [ 1 ].statusCode ).toBe ( 0 );
291+ expect ( failedResults [ 1 ].error ).toInclude ( " Boom from fake response callback " );
292+ var actualSubscribers = result . results . map ( function ( item ) {
293+ return item . subscriber ;
294+ } );
295+ var expectedSubscribers = [ " explode@example.com " , " ok@example.com " ] ;
296+ arraySort ( actualSubscribers , " textnocase " );
297+ arraySort ( expectedSubscribers , " textnocase" );
298+ expect ( actualSubscribers ). toBe ( expectedSubscribers );
297299 } );
298300
299301 it ( " falls back to sequential sends when async manager is missing" , function () {
0 commit comments