mirror of
https://github.com/hanzoai/core-js.git
synced 2026-09-24 16:58:15 +00:00
22 lines
730 B
JavaScript
22 lines
730 B
JavaScript
import { STRICT } from '../helpers/constants.js';
|
|
import { createIterator } from '../helpers/helpers.js';
|
|
|
|
QUnit.test('AsyncIterator#indexed', assert => {
|
|
const { indexed } = AsyncIterator.prototype;
|
|
|
|
assert.isFunction(indexed);
|
|
assert.arity(indexed, 0);
|
|
assert.name(indexed, 'indexed');
|
|
assert.looksNative(indexed);
|
|
assert.nonEnumerable(AsyncIterator.prototype, 'indexed');
|
|
|
|
if (STRICT) {
|
|
assert.throws(() => indexed.call(undefined, () => { /* empty */ }), TypeError);
|
|
assert.throws(() => indexed.call(null, () => { /* empty */ }), TypeError);
|
|
}
|
|
|
|
return indexed.call(createIterator(['a', 'b', 'c'])).toArray().then(it => {
|
|
assert.same(it.toString(), '0,a,1,b,2,c', 'basic functionality');
|
|
});
|
|
});
|