-
Notifications
You must be signed in to change notification settings - Fork 18
/
SumAsync.ts
19 lines (16 loc) · 721 Bytes
/
SumAsync.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { asAsync, itAsync, itEnumerableAsync, itParallel } from "../TestHelpers"
describe("sumAsync", () => {
itEnumerableAsync<{ a: number }>("sum Selector", async (asEnumerable) => {
const zooms = await asEnumerable([ { a: 1}, { a: 2 }, {a: 3} ])
.sumAsync(async (x) => x.a)
expect(zooms).toBe(6)
})
itAsync("sum Selector", async () => {
const zooms = asAsync([ { a: 1}, { a: 2 }, {a: 3} ])
expect(await zooms.sumAsync(async (x) => x.a)).toBe(6)
})
itParallel<{ a: number }>("sum Selector", async (asParallel) => {
const zooms = asParallel([ { a: 1}, { a: 2 }, {a: 3} ])
expect(await zooms.sumAsync(async (x) => x.a)).toBe(6)
})
})