Scenario tests
A file in tests/ walks the whole Startup in the test environment, as a buyer would, before a Change merges.
A file in tests/ walks the whole Startup in the test environment, as a buyer would: sign up, pay, use, renew.
tests/first-renewal.test.ts
Reference
TypeScript with startup-builder/.
| Export | Type | Holds |
|---|---|---|
walk(persona) | function | A synthetic buyer that drives every Interface |
clock.advance(duration) | function | Moves the test clock; everything due in between fires in order |
test, expect | function | Cases and assertions |
Examples
Minimal
import { expect, test, walk } from 'startup-builder/ test'
test('a manager can subscribe', async () => {
const manager = await walk('manager')
expect(await manager.subscribe('pro')).toBeTruthy()
})Leaseline
import { clock, expect, test, walk } from 'startup-builder/ test'
test('a lease ending in 60 days gets its notice', async () => {
const manager = await walk('manager')
await manager.subscribe('pro')
await manager.import('mappings/ rent-roll', 'fixtures/ rent-roll.csv')
await clock.advance('1 day')
expect(await manager.inbox()).toContainMessage('Your lease at 4B ends')
})What it builds
The StartupBuilder runs every scenario on each Change's preview.
- a check result per scenario;
Change.mergerefuses while one fails - no live money and no live Messages: the test environment fakes Stripe and mail
Good to know
- The same clock moves from the CLI:
npx startup-builder clock advance --by 30d.