from: Accept a callback function.
This commit is contained in:
parent
8c26f23ead
commit
6b577ea6cd
3 changed files with 38 additions and 14 deletions
|
@ -45,6 +45,12 @@ describe(`Channel`, function() {
|
|||
});
|
||||
|
||||
describe(`from`, function() {
|
||||
it(`callback`, async function() {
|
||||
let counter = 0;
|
||||
const callback = () => (counter < 3 ? counter++ : undefined);
|
||||
assert.deepEqual(await Channel.from(callback).values(), [0, 1, 2]);
|
||||
});
|
||||
|
||||
it(`iterable`, async function() {
|
||||
assert.deepEqual(await Channel.from([0, 1, 2]).values(), [0, 1, 2]);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue