fix(spec): export Direction, ScrollAction and LongPressAction from the entry

This commit is contained in:
pj committed 2026-08-15 13:31:32 +05:30
1 parent fb57ab2f56
commit 4b22b45b68
2 files changed
+24

No files matched your search

+3
View File
@@ -4,6 +4,7 @@ export type {
Action,
ActionGenerator,
AttrSelector,
Direction,
DoubleTapAction,
EventuallyFormula,
ExceptionRecord,
@@ -13,10 +14,12 @@ export type {
Key,
KnownAttrSelectors,
LogEntry,
LongPressAction,
Point,
PressKeyAction,
RawAttrs,
Sampler,
ScrollAction,
SelectorPath,
Snapshots,
State,
+21
View File
@@ -29,6 +29,12 @@ import {
weighted,
whenRoute,
} from "../src/index.ts";
import type {
Action,
Direction,
LongPressAction,
ScrollAction,
} from "../src/index.ts";
import { setSamplerRng } from "../src/actions.ts";
import { Pcg } from "../src/pcg.ts";
import type { GeneratorNode } from "../src/action-tree.ts";
@@ -397,3 +403,18 @@ test("whenRoute body is skipped for a null route", () => {
const node = whenRoute(route, ["home"], () => [Tap({ on: "id:x" })]);
assert.deepEqual((node as { generate: () => unknown }).generate(), []);
});
// The package entry is the only module a spec author can import from, so every
// member of the exported Action union, and the Direction needed to build a
// Scroll, has to be reachable there rather than only from src/types.ts.
test("index exports every action type a spec author annotates with", () => {
const direction: Direction = "down";
const scroll: ScrollAction = Scroll({ direction, in: "id:list" });
const longPress: LongPressAction = LongPress({ on: "id:row" });
const built: Action[] = [scroll, longPress];
assert.deepEqual(
built.map(action => action.kind),
["Scroll", "LongPress"],
);
});