Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d488da
commit 3f7d4ce
Showing
2 changed files
with
7 additions
and
12 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,14 +1,10 @@ | ||
import toArray from './' | ||
import all from './' | ||
import test from 'ava' | ||
|
||
test('Should collect all entries of an async iterator as an array', async (t) => { | ||
async function * iterator (values) { | ||
yield * values | ||
} | ||
const values = [0, 1, 2, 3, 4] | ||
|
||
const vals = [0, 1, 2, 3, 4] | ||
const res = await all(values) | ||
|
||
const arr = await toArray(iterator(vals)) | ||
|
||
t.deepEqual(arr, vals) | ||
t.deepEqual(res, values) | ||
}) |