"use strict";

import from from "../src/eslinq";

const owners = [
	{ name: "Kathy", pets: ["dog", "cat"] },
	{ name: "Johnny", pets: ["monkey", "spider"] },
	{ name: "Annie", pets: ["monkey", "cat"] }
];

describe("from", () => {

	it("is defined", () => {
		expect(from).toBeDefined();
	});

	it("returns something when given an empty array", () => {
		expect(from([])).toBeDefined();
	});

	describe("select", () => {

		const identity = n => n,
			double = n => n * 2;

		it("returns an empty iterable when given an empty iterable", () => {
			const original = [],
				expected = [],
				actual = from(original).select(identity).toArray();
			expect(actual).toEqual(expected);
		});

		it("returns the element itself when given the identity function", () => {
			const original = [1, 2],
			    expected = [1, 2],
				actual = from(original).select(identity).toArray();
			expect(actual).toEqual(expected);
		});
		
		it("can transform a one-element array", () => {
			const original = [1],
				expected = [2],
				actual = from(original).select(double).toArray();
			expect(actual).toEqual(expected);
		});
		
		it("can transform a two-element array", () => {
			const original = [1, 2],
			    expected = [2, 4],
				actual = from(original).select(double).toArray();
			expect(actual).toEqual(expected); 
		});

	});
});
@@ -384,16 +384,363 @@
 ();%0A%09%7D);
+%0A%09%0A%09describe(%22can also work with non-array iterables, like%22, () =%3E %7B%0A%0A%09%09const verifyForIterable = (iterable) =%3E %7B%0A%09%09%09const expected = %5B2, 4, 6%5D,%0A%09%09%09%09double = n =%3E n * 2,%0A%09%09%09%09actual = from(iterable).select(double).toArray();%0A%09%09%09expect(actual).toEqual(expected);%0A%09%09%7D;%0A%09%09%0A%09%09it(%22a set%22, () =%3E %7B%0A%09%09 %09verifyForIterable(new Set(%5B1, 2, 3%5D));%0A%09%09%7D);%0A%09%09%0A%09%7D);
 %0A%0A%09descr

Test case for using a Set as the input