Skip to content
Jupiter documentation
Menu

Test

Run the Vitest suite, which executes inside workerd against a real D1 database.

npm test runs the suite in test/ with the Cloudflare Workers Vitest integration. Tests execute inside workerd, the same runtime that serves production, against a real local D1 database. No Docker and no mocks for storage.

Run the suite#

How it works#

Three files set the stage:

Each test creates its own user with a unique name through registerAndLogin(), so tests never depend on each other's data.

Adding a test#

Import the helpers and call api() with a path and a fetch init:

The suite covers the auth guards (403, 401) and the registration paths (200, 409, 422). One end-to-end flow creates a classification, a recipe and an ingredient, maps and unmaps a weekly menu, reviews both, and walks every delete path.

Source: belikh/hello-fresh-API HEAD