Skip to content

Commit

Permalink
add some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Sep 16, 2022
1 parent 2ad3897 commit 689f184
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/pure/esnext.async-iterator.from.js
Expand Up @@ -4,7 +4,7 @@ import values from 'core-js-pure/es/array/values';
import AsyncIterator from 'core-js-pure/full/async-iterator';

QUnit.test('AsyncIterator.from', assert => {
assert.expect(9);
assert.expect(10);
const async = assert.async();
const { from } = AsyncIterator;

Expand All @@ -29,4 +29,5 @@ QUnit.test('AsyncIterator.from', assert => {
assert.throws(() => from(undefined), TypeError);
assert.throws(() => from(null), TypeError);
assert.throws(() => from({}), TypeError);
assert.throws(() => from(assign(new AsyncIterator(), { next: 42 })), TypeError);
});
2 changes: 2 additions & 0 deletions tests/pure/esnext.iterator.from.js
@@ -1,6 +1,7 @@
import { createIterable, createIterator } from '../helpers/helpers';

import Iterator from 'core-js-pure/full/iterator';
import assign from 'core-js-pure/es/object/assign';

QUnit.test('Iterator.from', assert => {
const { from } = Iterator;
Expand All @@ -17,4 +18,5 @@ QUnit.test('Iterator.from', assert => {
assert.throws(() => from(undefined), TypeError);
assert.throws(() => from(null), TypeError);
assert.throws(() => from({}), TypeError);
assert.throws(() => from(assign(new Iterator(), { next: 42 })), TypeError);
});
7 changes: 5 additions & 2 deletions tests/tests/esnext.async-iterator.from.js
@@ -1,5 +1,7 @@
const { assign } = Object;

QUnit.test('AsyncIterator.from', assert => {
assert.expect(12);
assert.expect(13);
const async = assert.async();
const { from } = AsyncIterator;

Expand All @@ -18,7 +20,7 @@ QUnit.test('AsyncIterator.from', assert => {
async();
});

const asyncIterator = Object.assign(new AsyncIterator(), {
const asyncIterator = assign(new AsyncIterator(), {
next: () => { /* empty */ },
});

Expand All @@ -27,4 +29,5 @@ QUnit.test('AsyncIterator.from', assert => {
assert.throws(() => from(undefined), TypeError);
assert.throws(() => from(null), TypeError);
assert.throws(() => from({}), TypeError);
assert.throws(() => from(assign(new AsyncIterator(), { next: 42 })), TypeError);
});
3 changes: 3 additions & 0 deletions tests/tests/esnext.iterator.from.js
@@ -1,5 +1,7 @@
import { createIterable, createIterator } from '../helpers/helpers';

const { assign } = Object;

QUnit.test('Iterator.from', assert => {
const { from } = Iterator;

Expand All @@ -18,4 +20,5 @@ QUnit.test('Iterator.from', assert => {
assert.throws(() => from(undefined), TypeError);
assert.throws(() => from(null), TypeError);
assert.throws(() => from({}), TypeError);
assert.throws(() => from(assign(new Iterator(), { next: 42 })), TypeError);
});

0 comments on commit 689f184

Please sign in to comment.