mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
test(spec): tolerate legacy bridge fields on builtin nodes
This commit is contained in:
1 parent
58585b88b2
commit
26e27832a2
2 files changed
+20
-12
No files matched your search
@@ -31,6 +31,7 @@ import {
|
||||
} from "../src/index.ts";
|
||||
import { setSamplerRng } from "../src/actions.ts";
|
||||
import { Pcg } from "../src/pcg.ts";
|
||||
import type { GeneratorNode } from "../src/action-tree.ts";
|
||||
import type {
|
||||
AccessibilityElement,
|
||||
EventuallyFormula,
|
||||
@@ -272,15 +273,21 @@ test("weighted returns a weighted node carrying the branches", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
test("builtin factories return builtin nodes", () => {
|
||||
assert.deepEqual(taps, { kind: "builtin", verb: "taps" });
|
||||
assert.deepEqual(doubleTaps, { kind: "builtin", verb: "doubleTaps" });
|
||||
assert.deepEqual(longPresses, { kind: "builtin", verb: "longPresses" });
|
||||
assert.deepEqual(scrolls, { kind: "builtin", verb: "scrolls" });
|
||||
assert.deepEqual(typing, { kind: "builtin", verb: "typing" });
|
||||
assert.deepEqual(swipes, { kind: "builtin", verb: "swipes" });
|
||||
assert.deepEqual(waitOnce, { kind: "builtin", verb: "waitOnce" });
|
||||
assert.deepEqual(pressKey, { kind: "builtin", verb: "pressKeys" });
|
||||
test("builtin factories return builtin nodes carrying their verb", () => {
|
||||
const cases: Array<[GeneratorNode, string]> = [
|
||||
[taps, "taps"],
|
||||
[doubleTaps, "doubleTaps"],
|
||||
[longPresses, "longPresses"],
|
||||
[scrolls, "scrolls"],
|
||||
[typing, "typing"],
|
||||
[swipes, "swipes"],
|
||||
[waitOnce, "waitOnce"],
|
||||
[pressKey, "pressKeys"],
|
||||
];
|
||||
for (const [node, verb] of cases) {
|
||||
assert.equal(node.kind, "builtin");
|
||||
assert.equal((node as { verb: string }).verb, verb);
|
||||
}
|
||||
});
|
||||
|
||||
test("from with a single item returns it without drawing", () => {
|
||||
|
||||
@@ -55,14 +55,15 @@ test("defaults bundle exports defaultActions as a weighted node", async () => {
|
||||
test("typing resolves as a builtin node", async () => {
|
||||
installRuntime(emptyState);
|
||||
const { typing } = await import("../src/defaults/actions.ts");
|
||||
assert.deepEqual(typing, { kind: "builtin", verb: "typing" });
|
||||
assert.equal(typing.kind, "builtin");
|
||||
assert.equal((typing as { verb: string }).verb, "typing");
|
||||
});
|
||||
|
||||
test("longPresses and scrolls resolve as builtin nodes", async () => {
|
||||
installRuntime(emptyState);
|
||||
const { longPresses, scrolls } = await import("../src/defaults/actions.ts");
|
||||
assert.deepEqual(longPresses, { kind: "builtin", verb: "longPresses" });
|
||||
assert.deepEqual(scrolls, { kind: "builtin", verb: "scrolls" });
|
||||
assert.equal((longPresses as { verb: string }).verb, "longPresses");
|
||||
assert.equal((scrolls as { verb: string }).verb, "scrolls");
|
||||
});
|
||||
|
||||
test("defaults barrel re-exports both properties and actions", async () => {
|
||||
|
||||
Reference in new issue
Block a user