CallwiseDocs

Tests

Unit tests, database security tests and the end-to-end smoke test.

CommandWhat it coversNeeds
pnpm testUnit tests: pricing rules, the store (cart, consent, orders), access levels, the demo generator, the script test engineNothing
pnpm test:rlsOne test per security invariant, including writes that must failLocal Supabase running and reset
pnpm test:e2ePlaywright smoke test of the demo, with third-party network blockedPlaywright and Chrome

Unit tests

pnpm test

Among other things these check that every plan, pack and add-on lists at or under $290 a month, and that averages such as handle time are never summed across days.

The store tests (pnpm --filter @callwise/store test) check that an order without consent is refused, that consent is stored with its timestamp, terms version and exact text, that term start, end and renewal dates are right, that an order's total equals the annual quote, that incompatible add-ons are refused, and that no refund path exists. For the free week they check that a first order charges $0 today and stores the trial and first-charge dates, that a second order for the same email gets no trial and is charged today, that the day-7 job charges once (run twice, one charge), never before day 7 and never a cancelled trial, that cancelling during the trial charges nothing and cancelling after the first charge is refused, and that card details are never stored in full.

Database security tests

pnpm supabase:web:start
pnpm supabase:web:reset
pnpm test:rls

Each test signs in as a seeded user and tries something the rules forbid: a member publishing a script, an owner raising their own plan, a user reading another workspace's calls. The test passes when Postgres refuses.

End-to-end

pnpm test:e2e

Opens the demo in a browser and clicks through the main pages. Requests to any outside host are blocked, so the test also proves the demo makes no external calls.

On this page