-
Notifications
You must be signed in to change notification settings - Fork 18
/
LastOrDefaultAsync.ts
26 lines (21 loc) · 924 Bytes
/
LastOrDefaultAsync.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
import { asAsync, itAsync, itEnumerableAsync, itParallel } from "../TestHelpers"
describe("lastOrDefaultAsync", () => {
itEnumerableAsync("Basic", async (asEnumerable) => {
expect(await asEnumerable([1, 2, 3]).lastOrDefaultAsync(async (x) => x === 4))
.toBeNull()
expect(await asEnumerable([1, 2]).lastOrDefaultAsync(async (x) => x === 1))
.toBe(1)
})
itAsync("Basic", async () => {
expect(await asAsync([1, 2, 3]).lastOrDefaultAsync(async (x) => x === 4))
.toBeNull()
expect(await asAsync([1, 2]).lastOrDefaultAsync(async (x) => x === 1))
.toBe(1)
})
itParallel("Basic", async (asParallel) => {
expect(await asParallel([1, 2, 3]).lastOrDefaultAsync(async (x) => x === 4))
.toBeNull()
expect(await asParallel([1, 2]).lastOrDefaultAsync(async (x) => x === 1))
.toBe(1)
})
})