File tree 2 files changed +16
-9
lines changed
2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -227,20 +227,16 @@ class EmberApp {
227
227
* @return {Promise<instance> } instance
228
228
*/
229
229
visitRoute ( path , fastbootInfo , bootOptions , result ) {
230
- let instance ;
231
-
232
230
return this . buildAppInstance ( )
233
- . then ( appInstance => {
234
- instance = appInstance ;
231
+ . then ( instance => {
235
232
result . instance = instance ;
236
233
registerFastBootInfo ( fastbootInfo , instance ) ;
237
-
238
234
return instance . boot ( bootOptions ) ;
239
235
} )
240
236
. then ( ( ) => result . instanceBooted = true )
241
- . then ( ( ) => instance . visit ( path , bootOptions ) )
237
+ . then ( ( ) => result . instance . visit ( path , bootOptions ) )
242
238
. then ( ( ) => fastbootInfo . deferredPromise )
243
- . then ( ( ) => instance ) ;
239
+ . then ( ( ) => result ) ;
244
240
}
245
241
246
242
/**
Original file line number Diff line number Diff line change @@ -106,7 +106,18 @@ describe("FastBoot", function() {
106
106
distPath : fixture ( 'basic-app' )
107
107
} ) ;
108
108
109
- return fastboot . visit ( '/' , { destroyAppInstanceInMs : 5 } )
109
+ // delaying `visitRoute` to forcefully destroy app instance
110
+ let originalVisitRoute = fastboot . _app . visitRoute ;
111
+ fastboot . _app . visitRoute = function ( ) {
112
+ return originalVisitRoute . apply ( this , arguments )
113
+ . then ( function ( ) {
114
+ return new Promise ( function ( resolve ) {
115
+ setTimeout ( resolve , 2000 ) ;
116
+ } ) ;
117
+ } ) ;
118
+ } ;
119
+
120
+ fastboot . visit ( '/' , { destroyAppInstanceInMs : 5 } )
110
121
. catch ( ( e ) => {
111
122
expect ( e . message ) . to . equal ( 'App instance was forcefully destroyed in 5ms' ) ;
112
123
done ( ) ;
@@ -349,7 +360,7 @@ describe("FastBoot", function() {
349
360
distPath : fixture ( 'boot-time-failing-app' )
350
361
} ) ;
351
362
352
- return fastboot . visit ( '/' )
363
+ fastboot . visit ( '/' )
353
364
. catch ( ( e ) => {
354
365
expect ( e ) . to . be . an ( 'error' ) ;
355
366
done ( ) ;
You can’t perform that action at this time.
0 commit comments