forked from arogozine/LinqToTypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnyAsync.ts
54 lines (39 loc) · 1.89 KB
/
AnyAsync.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { asAsync, itAsync, itEnumerableAsync, itParallel } from "./../TestHelpers"
describe("anyAsync", () => {
itEnumerableAsync("Empty", async (asEnumerable) => {
const array = asEnumerable([])
expect(await array.anyAsync(async (_) => true)).toBe(false)
expect(await array.anyAsync(async (_) => false)).toBe(false)
})
itAsync("Empty", async () => {
const array = asAsync([])
expect(await array.anyAsync(async (_) => true)).toBe(false)
expect(await array.anyAsync(async (_) => false)).toBe(false)
})
itParallel("Empty", async (asParallel) => {
const array = asParallel([])
expect(await array.anyAsync(async (_) => true)).toBe(false)
expect(await array.anyAsync(async (_) => false)).toBe(false)
})
itEnumerableAsync("AnyExists", async (asEnumerable) => {
const array = asEnumerable([1, 2])
expect(await array.anyAsync(async (_) => true)).toBe(true)
expect(await array.anyAsync(async (_) => false)).toBe(false)
expect(await array.anyAsync(async (x) => x === 1)).toBe(true)
expect(await array.anyAsync(async (x) => x === 2)).toBe(true)
})
itAsync("AnyExists", async () => {
const array = asAsync([1, 2])
expect(await array.anyAsync(async (_) => true)).toBe(true)
expect(await array.anyAsync(async (_) => false)).toBe(false)
expect(await array.anyAsync(async (x) => x === 1)).toBe(true)
expect(await array.anyAsync(async (x) => x === 2)).toBe(true)
})
itParallel("AnyExists", async (asParallel) => {
const array = asParallel([1, 2])
expect(await array.anyAsync(async (_) => true)).toBe(true)
expect(await array.anyAsync(async (_) => false)).toBe(false)
expect(await array.anyAsync(async (x) => x === 1)).toBe(true)
expect(await array.anyAsync(async (x) => x === 2)).toBe(true)
})
})