-
Notifications
You must be signed in to change notification settings - Fork 18
/
ToMapAsync.ts
30 lines (27 loc) · 1.03 KB
/
ToMapAsync.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
import { asAsync, itAsync, itEnumerableAsync, itParallel } from "../TestHelpers"
describe("toMapAsync", () => {
itEnumerableAsync("toMap", async (asEnumerable) => {
const map = await asEnumerable([1, 2, 3]).toMapAsync(async (x) => `Key_${ x }`)
for (const keyValue of map) {
const key = keyValue[0]
const value = keyValue[1]
expect(key).toBe(`Key_${ value[0] }`)
}
})
itAsync("toMap", async () => {
const map = await asAsync([1, 2, 3]).toMapAsync(async (x) => `Key_${ x }`)
for (const keyValue of map) {
const key = keyValue[0]
const value = keyValue[1]
expect(key).toBe(`Key_${ value[0] }`)
}
})
itParallel("toMap", async (asParallel) => {
const map = await asParallel([1, 2, 3]).toMapAsync(async (x) => `Key_${ x }`)
for (const keyValue of map) {
const key = keyValue[0]
const value = keyValue[1]
expect(key).toBe(`Key_${ value[0] }`)
}
})
})