deno.land / x / froebel@v0.23.2 / callAll.test.ts

callAll.test.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
import callAll from "./callAll.ts";import { assertEquals } from "testing/asserts.ts";import { assertSpyCalls, spy } from "testing/mock.ts";
Deno.test("call all", () => { const square = spy((n: number) => n ** 2); const cube = spy((n: number) => n ** 3);
assertEquals(callAll([square, cube], 2), [4, 8]); assertSpyCalls(square, 1); assertSpyCalls(cube, 1);
// @ts-expect-error callAll([(_n: number) => 0]);
// @ts-expect-error callAll([(_n: number) => 0], "");
// @ts-expect-error callAll([square, (_n: string) => 0], 2);
// @ts-expect-error const _str: string[] = callAll([() => 2]);
// @ts-expect-error const [_a, _b] = callAll([() => 2]);});
froebel

Version Info

Tagged at
a year ago