Add is.asyncIterable
This commit is contained in:
parent
c84c2cbeca
commit
77a86c0fe3
3 changed files with 20 additions and 1 deletions
|
|
@ -10,6 +10,7 @@ import ZenObservable from 'zen-observable';
|
|||
import m from '..';
|
||||
|
||||
const isNode8orHigher = Number(process.versions.node.split('.')[0]) >= 8;
|
||||
const isNode10orHigher = Number(process.versions.node.split('.')[0]) >= 10;
|
||||
|
||||
class PromiseSubclassFixture<T> extends Promise<T> {}
|
||||
class ErrorSubclassFixture extends Error {}
|
||||
|
|
@ -337,6 +338,14 @@ const types = new Map<string, Test>([
|
|||
Infinity,
|
||||
-Infinity
|
||||
]
|
||||
}],
|
||||
['asyncIterable', {
|
||||
is: m.asyncIterable,
|
||||
fixtures: [
|
||||
Object.create({
|
||||
[Symbol.asyncIterator]: () => {} // tslint:disable-line:no-empty
|
||||
})
|
||||
]
|
||||
}]
|
||||
]);
|
||||
|
||||
|
|
@ -454,6 +463,14 @@ if (isNode8orHigher) {
|
|||
});*/
|
||||
}
|
||||
|
||||
if (isNode10orHigher) {
|
||||
test('is.asyncIterable', t => {
|
||||
t.true(m.asyncIterable(Object.create({
|
||||
[Symbol.asyncIterator]: () => {} // tslint:disable-line:no-empty
|
||||
})));
|
||||
});
|
||||
}
|
||||
|
||||
test('is.generator', t => {
|
||||
testType(t, 'generator');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue