feat(folio): layer defaultActions breadth over targeted flows

This commit is contained in:
pj committed 2026-05-25 18:14:40 +05:30
1 parent 7fd8b6d347
commit bf235e54c2
1 file changed
+5 -7
+5 -7
View File
@@ -11,6 +11,7 @@ import {
weighted, weighted,
whenRoute, whenRoute,
} from "@sanderling/spec"; } from "@sanderling/spec";
import { defaultActions } from "@sanderling/spec/defaults";
interface Account { interface Account {
name: string; name: string;
@@ -80,7 +81,6 @@ const txnSubmit = extract(s =>
s.ax.find([{ testTag: "AddTransactionScreen" }, { testTag: "TxnSubmit" }])); s.ax.find([{ testTag: "AddTransactionScreen" }, { testTag: "TxnSubmit" }]));
const accountCards = extract(s => const accountCards = extract(s =>
s.ax.findAll([{ testTag: "HomeScreen" }, { testTag: "AccountCard" }])); s.ax.findAll([{ testTag: "HomeScreen" }, { testTag: "AccountCard" }]));
const backButton = extract(s => s.ax.find({ testTag: "BackButton" }));
// Property 1: every newly-appearing account starts with balance === 0. // Property 1: every newly-appearing account starts with balance === 0.
// Identity is by visible name. Guard against navigation transitions where // Identity is by visible name. Guard against navigation transitions where
@@ -165,11 +165,6 @@ const addTxn = whenRoute(route, ["home", "ledger", "add-transaction"], () => {
return opts; return opts;
}); });
const back = actions(() => {
const btn = backButton.current;
return btn ? [Tap({ on: btn })] : [];
});
export const properties = { export const properties = {
newAccountBalanceIsZero, newAccountBalanceIsZero,
newTxnChangesBalance, newTxnChangesBalance,
@@ -177,10 +172,13 @@ export const properties = {
export const setup = login; export const setup = login;
// Targeted depth (addAccount / addTxn) drives the deep flows; defaultActions
// adds breadth so the fuzzer wanders the whole app and types edge-case values
// into every field, stressing the balance invariants above.
export const actionsRoot = weighted( export const actionsRoot = weighted(
[50, addAccount], [50, addAccount],
[40, addTxn], [40, addTxn],
[10, back], [20, defaultActions],
); );
(globalThis as { actions?: unknown; properties?: unknown; setup?: unknown }).actions = actionsRoot; (globalThis as { actions?: unknown; properties?: unknown; setup?: unknown }).actions = actionsRoot;