-
Notifications
You must be signed in to change notification settings - Fork 18
/
DistinctAsync.ts
22 lines (18 loc) · 927 Bytes
/
DistinctAsync.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { asAsync, itAsync, itEnumerableAsync, itParallel } from "../TestHelpers"
describe("distinctAsync", () => {
// tslint:disable:triple-equals
itEnumerableAsync<string | number>("DistinctWeakEquality", async (asEnumerable) => {
const array = asEnumerable(["1", 1, 2, 2, 3, "3"])
const distinct = await array.distinctAsync(async (x, y) => x == y).toArray()
expect(distinct).toEqual(["1", 2, 3])
})
itAsync("DistinctWeakEquality", async () => {
const array = asAsync(["1", 1, 2, 2, 3, "3"])
expect(await array.distinctAsync(async (x, y) => x == y).toArray()).toEqual(["1", 2, 3])
})
itParallel<string | number>("DistinctWeakEquality", async (asParallel) => {
const array = asParallel(["1", 1, 2, 2, 3, "3"])
const distinct = await array.distinctAsync(async (x, y) => x == y).toArray()
expect(distinct).toEqual(["1", 2, 3])
})
})