-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
test66.ts
30 lines (21 loc) 路 793 Bytes
/
test66.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
//NOTE: We want it to work with undefined for user that can't use null (eslint rule)
import { Evt } from "../lib/index.ts";
import { getHandlerPr } from "./getHandlerPr.ts";
import { getPromiseAssertionApi } from "../tools/testing/getPromiseAssertionApi.ts";
const { mustStayPending } = getPromiseAssertionApi();
const evt = new Evt<string | string[]>();
mustStayPending(
getHandlerPr(evt, () =>
evt.$attach(
(data): [string] | null => typeof data !== "string" ? undefined as unknown as null : [data],
() => { }
))
)
mustStayPending(
evt.waitFor(
(data): [string] | null => typeof data !== "string" ? undefined as unknown as null : [data]
)
);
evt.post(["a", "b", "c"]);
evt.post(["a", "b", "c", "d"]);
console.log("PASS");