Skip to content

Commit 6dd57a3

Browse files
committed
fixed tests, now they are broken
mocha has behavior of setting test as passing if `promise` returned inside `it(....)` passing, but if you have assertion in `.catch` it might skip assertion because returned promise resolved, to avoid that you need finish assertion with `done` because of it I think some of errors have been missed in master
1 parent c3a8c83 commit 6dd57a3

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

test/fastboot-test.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,15 @@ describe("FastBoot", function() {
101101
});
102102
});
103103

104-
it("can forcefully destroy the app instance using destroyAppInstanceInMs", function() {
104+
it("can forcefully destroy the app instance using destroyAppInstanceInMs", function(done) {
105105
var fastboot = new FastBoot({
106106
distPath: fixture('basic-app')
107107
});
108108

109-
return fastboot.visit('/', {
110-
destroyAppInstanceInMs: 5
111-
})
109+
return fastboot.visit('/', { destroyAppInstanceInMs: 5 })
112110
.catch((e) => {
113111
expect(e.message).to.equal('App instance was forcefully destroyed in 5ms');
112+
done();
114113
});
115114
});
116115

@@ -158,14 +157,15 @@ describe("FastBoot", function() {
158157
return expect(fastboot.visit('/')).to.be.rejected;
159158
});
160159

161-
it("catches the error if an error occurs", function() {
160+
it("catches the error if an error occurs", function(done) {
162161
var fastboot = new FastBoot({
163162
distPath: fixture('rejected-promise')
164163
});
165164

166165
fastboot.visit('/')
167166
.catch(function(err) {
168-
return expect(err).to.be.not.null;
167+
expect(err).to.be.not.null;
168+
done();
169169
});
170170
});
171171

@@ -344,13 +344,16 @@ describe("FastBoot", function() {
344344
}
345345
});
346346

347-
it("handles apps boot-time failures by throwing Errors", function() {
347+
it("handles apps boot-time failures by throwing Errors", function(done) {
348348
var fastboot = new FastBoot({
349349
distPath: fixture('boot-time-failing-app')
350350
});
351351

352352
return fastboot.visit('/')
353-
.catch((e) => expect(e).to.be.an('error'));
353+
.catch((e) => {
354+
expect(e).to.be.an('error');
355+
done();
356+
});
354357
});
355358

356359
});

0 commit comments

Comments
 (0)