ambler-test
Ambler Test
Follow these steps to create a test file for a node in the nodes/ directory.
1. Gather requirements
Before writing any code, determine:
- Node name: The camelCase name (e.g.,
retry,prompt,validate) — the test file will benodes/tests/<name>.test.ts. - Node's State, Edges, and Utils: Read
nodes/<name>.tsto understand what the node does, which edges it has, and what utils it uses. - Branches to cover: Every
return [edges.onEdgeName, ...]line is one branch; terminal nodes return[edges.onDone, state]whereonDonewill benullin the walk. List them all before writing any test.
If any of the above is unclear, read the node file first.
2. Determine sync vs async
Look at the node's factory return type:
More from argenkiwi/ambler-ts
ambler-init
Initializes a new Ambler state-machine project. Use this whenever a user wants to start a new Ambler project, bootstrap a state-machine app, or set up the Ambler folder structure — even if they just say "new project" or "set up ambler" or "create ambler folder".
13ambler-walk
Creates a complete Ambler walk — the TypeScript wiring file (walks/<name>.ts) and the Markdown spec (specs/<name>.md) — and ensures all required nodes exist. Use this whenever a user wants to add a new program or flow to an Ambler project, even if they say "new walk", "add a program", "wire up these nodes", or just describe what they want the app to do.
13ambler-spec
Creates or updates a Markdown specification file for an Ambler walk in the specs/ directory. Use this whenever a user wants to document, plan, or describe a walk — including "write a spec", "document this walk", or "plan out the nodes" — even before any code exists.
12ambler-util
Creates or extracts utility modules into the utils/ directory of an Ambler project. Use this whenever a node's defaultUtils needs external npm/jsr dependencies, contains logic reusable across multiple nodes, or has implementations too complex to inline — even if the user just says "add a util", "extract this helper", "share this function", "create a utility", or "this code is getting too long for the node". When a user creates a node that imports an npm package or has complex async logic, proactively suggest using this skill.
9ambler-node
Creates a new Ambler node in the nodes/ directory. Use this whenever the user wants to add a node, step, or state to an Ambler project — even if they phrase it as "add a step", "create a handler", or describe the behavior without using the word "node".
8ambler-core
Creates a new Ambler core in the cores/ directory. Use this whenever the user wants to add a core, step, or state to an Ambler project — even if they phrase it as "add a step", "create a handler", or describe the behavior without using the word "core".
4