test
Verify APIs, jobs and tasks in the editor before starting.
API, Job and Task testing
- The API writes a filter and a valid sample together in the config object.
- The test run passes config.sample to the handler like actual request data.
- The *.job.ts file tests the handler immediately without queuing or retrying.
- *.task.ts files test handlers immediately without waiting for a reservation time.
- The server/tasks file is not scanned or executed simply by selection.
- *.ws.ts and *.sse.ts are sent to the test website endpoint only when you press Run Test. Connect to display results.
- SSE and WebSocket tests with auth set to true use a login session on the test website. Required as is, the editor will not bypass authentication.
- The console only displays the actual return value of the handler, not wrapper information.
- Support code automatically applies internal Oxfmt rules when saved and does not run any tests.
- When saving, check Oxlint errors and shared/Prisma creation results.
- Scripts/build/build-check in the administrator repository includes lint, TypeScript, and runtime Runs unit tests.
Bun unit tests
You can create *.test.ts files anywhere under server. file Select it and press Run Test to run that one file immediately.
Review prepares build/debug and runs every *.test.ts file. If any test fails, the review website is not shown in WEB PREVIEW. Review uses shared data, so tests that mutate data must clean it up themselves.
test, expect, and Runtime's fetchGet·fetchPost are provided automatically. The relative API address connects to the test website and contains methods, paths, requests/responses, and Automatically displays verification results in the test console. fetchGet·fetchPost The same relative address can be used on the website's client and server.
// server/api/example.test.ts
const config = {
active: true,
describe: "API",
timeout: 2_000
}
export default () => {
test("Respond with website status", async () => {
const data = await fetchGet<{ state: string }>("/api/status")
expect(data).toMatchObject({
state: "running"
})
})
}