/
IntersectAsync.ts
29 lines (22 loc) · 1016 Bytes
/
IntersectAsync.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { asAsync, itAsync, itEnumerableAsync, itParallel } from "../TestHelpers"
// tslint:disable:triple-equals
describe("intersect", () => {
itEnumerableAsync<string | number>("IntersectWithEqualityComparer", async (asEnumerable) => {
const array = await asEnumerable([1, 2, "3"])
.intersectAsync(asEnumerable(["1", "2"]), async (x, y) => x == y)
.toArray()
expect(array).toEqual([1, 2])
})
itAsync("IntersectWithEqualityComparer", async () => {
const array = await asAsync([1, 2, "3"])
.intersectAsync(asAsync<string | number>(["1", "2"]), async (x, y) => x == y)
.toArray()
expect(array).toEqual([1, 2])
})
itParallel<string | number>("IntersectWithEqualityComparer", async (asParallel) => {
const array = await asParallel([1, 2, "3"])
.intersectAsync(asAsync<string | number>(["1", "2"]), async (x, y) => x == y)
.toArray()
expect(array).toEqual([1, 2])
})
})