Skip to content

Commit 3efcdb0

Browse files
committed
fixed forcefully destroy the app instance test
1 parent 6308c5f commit 3efcdb0

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Diff for: test/fastboot-test.js

+13-2
Original file line numberDiff line numberDiff 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();

0 commit comments

Comments
 (0)