File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -227,20 +227,16 @@ class EmberApp {
227227 * @return {Promise<instance> } instance
228228 */
229229 visitRoute ( path , fastbootInfo , bootOptions , result ) {
230- let instance ;
231-
232230 return this . buildAppInstance ( )
233- . then ( appInstance => {
234- instance = appInstance ;
231+ . then ( instance => {
235232 result . instance = instance ;
236233 registerFastBootInfo ( fastbootInfo , instance ) ;
237-
238234 return instance . boot ( bootOptions ) ;
239235 } )
240236 . then ( ( ) => result . instanceBooted = true )
241- . then ( ( ) => instance . visit ( path , bootOptions ) )
237+ . then ( ( ) => result . instance . visit ( path , bootOptions ) )
242238 . then ( ( ) => fastbootInfo . deferredPromise )
243- . then ( ( ) => instance ) ;
239+ . then ( ( ) => result ) ;
244240 }
245241
246242 /**
Original file line number Diff line number Diff line change @@ -106,7 +106,18 @@ describe("FastBoot", function() {
106106 distPath : fixture ( 'basic-app' )
107107 } ) ;
108108
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 } )
110121 . catch ( ( e ) => {
111122 expect ( e . message ) . to . equal ( 'App instance was forcefully destroyed in 5ms' ) ;
112123 done ( ) ;
@@ -349,7 +360,7 @@ describe("FastBoot", function() {
349360 distPath : fixture ( 'boot-time-failing-app' )
350361 } ) ;
351362
352- return fastboot . visit ( '/' )
363+ fastboot . visit ( '/' )
353364 . catch ( ( e ) => {
354365 expect ( e ) . to . be . an ( 'error' ) ;
355366 done ( ) ;
You can’t perform that action at this time.
0 commit comments