Add testing framework with 48 unit tests, 8 E2E tests, and demo app#1
Open
aaronDowning wants to merge 3 commits intooojacoboo:mainfrom
Open
Add testing framework with 48 unit tests, 8 E2E tests, and demo app#1aaronDowning wants to merge 3 commits intooojacoboo:mainfrom
aaronDowning wants to merge 3 commits intooojacoboo:mainfrom
Conversation
Adds a testing foundation for IntentFlow with three layers: **Reference implementations (src/)** Minimal defineFlow, defineIntent, and FlowRegistry that validate the spec's TypeScript examples are structurally sound. **Unit tests (tests/) — 48 tests** - Schema validation: Zod schemas accept valid props, reject boundary cases (empty arrays, negative values, invalid enums) - State machine: XState transitions for happy path, error recovery, cancellation, self-transitions, and invalid event handling - Intent extraction: entity parsing, defaults, required vs optional - Registry: registration, lookup, filtering, duplicate prevention, AI tool definition generation, constraint enforcement **E2E tests (tests/e2e/) — 8 tests** - Intent matching: natural language → correct Flow rendered - Registry constraint: unregistered intents blocked - State machine: full payment lifecycle in the browser **Demo app (demo/)** Minimal Express app demonstrating the full IntentFlow lifecycle: intent input → registry lookup → schema validation → state machine transitions → UI rendering. Three Flows: overdue payments, pay rent, create work order. **Testing guide (docs/guides/testing.md)** Strategy guide covering schema, state machine, registry, and intent testing layers with code examples. Run: npm test (unit) | npm run test:e2e (browser) | npm run demo (app)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
I read through the spec and built a testing foundation to validate that the examples are structurally sound and behaviorally correct.
docs/guides/testing.mdcovering the testing strategy for each layerWhat's included
How to run
Approach
The
src/implementations are intentionally minimal — just enough to make the spec examples runnable and testable. They validate the contracts described in the docs (intentId format, meta requirements, schema enforcement, state machine behavior) without making assumptions about the production implementation.Happy to iterate on this — let me know what direction you'd like to take it.