-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): revert scheduler to not manage errors in handler
- Loading branch information
Showing
12 changed files
with
193 additions
and
162 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
|
||
{tags} = require '../test' | ||
schedule = require '../../src/schedulers/native' | ||
|
||
describe 'scheduler.instance', -> | ||
return unless tags.api | ||
|
||
describe 'usage', -> | ||
|
||
it 'is a promise', -> | ||
schedule() | ||
.should.be.a.Promise() | ||
|
||
describe 'resolve', -> | ||
|
||
it 'accept handlers in its arguments', -> | ||
schedule([ | ||
-> new Promise (accept) -> setImmediate accept 1 | ||
-> new Promise (accept) -> accept 2 | ||
]) | ||
.should.be.resolvedWith [1, 2] | ||
|
||
it 'accept empty array', -> | ||
schedule([]) | ||
.should.be.resolvedWith [] | ||
|
||
it 'accept null', -> | ||
schedule([]) | ||
.should.be.resolvedWith [] | ||
|
||
it 'not affected by push', -> | ||
scheduler = schedule() | ||
scheduler.push [ | ||
-> new Promise (accept) -> setImmediate accept 1 | ||
-> new Promise (accept) -> accept 2 | ||
] | ||
scheduler.push -> new Promise (accept) -> accept 3 | ||
scheduler | ||
.should.be.resolvedWith [] | ||
|
||
describe 'error', -> | ||
|
||
it 'first', -> | ||
schedule([ | ||
-> new Promise (accept, reject) -> reject Error 'catchme' | ||
-> new Promise (accept) -> setImmediate accept 1 | ||
-> new Promise (accept) -> setImmediate accept 2 | ||
]) | ||
.should.be.rejectedWith 'catchme' | ||
|
||
it 'middle', -> | ||
schedule([ | ||
-> new Promise (accept, reject) -> reject Error 'catchme' | ||
-> new Promise (accept) -> setImmediate accept 1 | ||
-> new Promise (accept) -> setImmediate accept 2 | ||
]) | ||
.should.be.rejectedWith 'catchme' | ||
|
||
it 'last', -> | ||
schedule([ | ||
-> new Promise (accept) -> setImmediate accept 1 | ||
-> new Promise (accept) -> setImmediate accept 2 | ||
-> new Promise (accept, reject) -> reject Error 'catchme' | ||
]) | ||
.should.be.rejectedWith 'catchme' |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.