geninq
Version:
A JavaScript version of the Linq library for Generators
47 lines (45 loc) • 952 B
text/typescript
import { It } from "../test-utils";
import "./except";
import "./array";
It("Will except on numbers", (g) => g.except([2]).array(), [1, 3], [1, 2, 3]);
It(
"Will except on strings",
(g) => g.except(["2"]).array(),
["1", "3"],
["1", "2", "3"]
);
It(
"Will except on booleans",
(g) => g.except([false]).array(),
[true],
[true, false]
);
It(
"Will except on custom comparitor",
(g) => g.except([{ test: 2 }], (a, b) => a.test === b.test).array(),
[{ test: 1 }, { test: 3 }],
[{ test: 1 }, { test: 2 }, { test: 3 }]
);
It(
"Will except on custom comparitor with a complex sequence",
(g) => g.except([{ test: 2 }], (a, b) => a.test === b.test).array(),
[
{ test: 1 },
{ test: 3 },
{ test: 4 },
{ test: 5 },
{ test: 1 },
{ test: 4 },
],
[
{ test: 1 },
{ test: 2 },
{ test: 3 },
{ test: 2 },
{ test: 4 },
{ test: 5 },
{ test: 1 },
{ test: 2 },
{ test: 4 },
]
);