Skip to content

Commit

Permalink
test(from): update from test to include checking when input is Itrabb…
Browse files Browse the repository at this point in the history
…le instance
  • Loading branch information
desnor committed Feb 20, 2024
1 parent 2bf4b86 commit db5c787
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, it } from 'vitest';
import { describe, expect, it } from 'vitest';
import { from, of } from '../src/';

const arrayStrings = ['a', 'b', 'c', 'd'];
Expand All @@ -11,11 +11,23 @@ const mapStrings = new Map([
const arrayStringsIt = from(arrayStrings);
const mapStringsIt = from(mapStrings);

it('from', () => {
const itrabble = from([1, 2, 3]);
const nums = itrabble.toArray;

expect(nums).toEqual([1, 2, 3]);
describe('from', () => {
describe('with instance of Itrabble as param', () => {
it('returns instance', () => {
const original = from([1, 2, 3]);
const nums = from(original);

expect(nums).toBe(original);
});
});
describe('with other input as param', () => {
it('returns itrabble of input', () => {
const itrabble = from([1, 2, 3]);
const nums = itrabble.toArray;

expect(nums).toEqual([1, 2, 3]);
});
});
});

it('of', () => {
Expand Down

0 comments on commit db5c787

Please sign in to comment.