mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 17:06:16 -04:00
tests: Teach waitFor()
to reject if the predicate throws
This commit is contained in:
parent
262eb9af60
commit
8016bd225f
2 changed files with 15 additions and 8 deletions
|
@ -155,6 +155,15 @@ describe("the test helper", function(){
|
|||
});
|
||||
});
|
||||
|
||||
it('rejects if the predicate throws', async function() {
|
||||
let err;
|
||||
await helper.waitFor(() => { throw new Error('test exception'); })
|
||||
.fail(() => {}) // Suppress the redundant uncatchable exception.
|
||||
.catch((e) => { err = e; });
|
||||
expect(err).to.be.an(Error);
|
||||
expect(err.message).to.be('test exception');
|
||||
});
|
||||
|
||||
describe("returns a deferred object", function(){
|
||||
it("it calls done after success", function(done){
|
||||
helper.waitFor(function(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue