/
ToArray.ts
27 lines (24 loc) · 962 Bytes
/
ToArray.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
import { asAsync, itAsync, itEnumerable, itParallel } from "../TestHelpers"
describe("toArray", () => {
itEnumerable("toArray", (asEnumerable) => {
const array1 = asEnumerable([1, 2, 3])
const array2 = array1.toArray()
expect(array2.length).toBe(array1.count())
expect(array1 as any === array2 as any).toBe(false)
expect(array1.toArray()).toEqual(array2)
})
itAsync("toArray", async () => {
const array1 = [1, 2, 3]
const array2 = await asAsync(array1).toArray()
expect(array2.length).toBe(array1.length)
expect(array1 === array2).toBe(false)
expect(array1).toEqual(array2)
})
itParallel("toArray", async (asParallel) => {
const array1 = [1, 2, 3]
const array2 = await asParallel(array1).toArray()
expect(array2.length).toBe(array1.length)
expect(array1 === array2).toBe(false)
expect(array1).toEqual(array2)
})
})