|
1 | 1 | --- |
2 | 2 | name: scenario-writer |
3 | | -description: Create integration test scenarios. Use when user needs Probitas scenarios. |
| 3 | +description: Create and edit *.probitas.ts files. Use when writing new Probitas scenarios, editing existing ones, or implementing E2E tests. |
4 | 4 | --- |
5 | 5 |
|
6 | | -Expert Probitas scenario writer. Documentation-driven, best practices. |
| 6 | +## Template |
| 7 | + |
| 8 | +```typescript |
| 9 | +import { client, expect, scenario } from "jsr:@probitas/probitas"; |
| 10 | + |
| 11 | +export default scenario("Test name", { tags: ["..."] }) |
| 12 | + .resource("http", () => |
| 13 | + client.http.createHttpClient({ |
| 14 | + url: Deno.env.get("API_URL") ?? "http://localhost:8080", |
| 15 | + })) |
| 16 | + .step("Step name", async (ctx) => { |
| 17 | + const res = await ctx.resources.http.post("/endpoint", { body: {} }); |
| 18 | + expect(res).toBeOk().toHaveStatus(200); |
| 19 | + return res.json<{ id: number }>()!; |
| 20 | + }) |
| 21 | + .build(); |
| 22 | +``` |
7 | 23 |
|
8 | 24 | ## Workflow |
9 | 25 |
|
10 | | -1. **Before**: Fetch docs via WebFetch |
11 | | - (https://jsr-probitas.github.io/documents/llms.txt) |
12 | | -2. **During**: Use `probitas` skill patterns, follow conventions |
13 | | -3. **After**: Run `/probitas:check`, fix issues |
| 26 | +1. Write scenario following template above |
| 27 | +2. Run `/probitas:check`, fix issues |
| 28 | +3. If unsure, fetch specific API docs from links below |
14 | 29 |
|
15 | 30 | ## Checklist |
16 | 31 |
|
17 | 32 | - [ ] `export default` + `.build()` |
18 | 33 | - [ ] Resources via `.resource()` |
19 | 34 | - [ ] Setup returns cleanup function |
20 | 35 | - [ ] Env vars for URLs |
21 | | -- [ ] Specific assertions |
| 36 | +- [ ] Chain assertions with `expect()` |
22 | 37 | - [ ] Tags for filtering |
23 | 38 | - [ ] File: `probitas/{name}.probitas.ts` |
24 | 39 |
|
25 | | -## When Uncertain |
| 40 | +## Docs |
26 | 41 |
|
27 | | -Fetch specific docs: |
| 42 | +Guides: |
28 | 43 |
|
| 44 | +- Scenario: https://jsr-probitas.github.io/documents/docs/scenario/index.md |
29 | 45 | - Client: https://jsr-probitas.github.io/documents/docs/client/index.md |
30 | | -- Assertions: https://jsr-probitas.github.io/documents/docs/expect/index.md |
| 46 | +- Expect: https://jsr-probitas.github.io/documents/docs/expect/index.md |
| 47 | + |
| 48 | +API Reference (by client): |
| 49 | + |
| 50 | +- HTTP: https://jsr-probitas.github.io/documents/api/client-http/index.md |
| 51 | +- gRPC: https://jsr-probitas.github.io/documents/api/client-grpc/index.md |
| 52 | +- ConnectRPC: https://jsr-probitas.github.io/documents/api/client-connectrpc/index.md |
| 53 | +- GraphQL: https://jsr-probitas.github.io/documents/api/client-graphql/index.md |
| 54 | +- PostgreSQL: https://jsr-probitas.github.io/documents/api/client-sql-postgres/index.md |
| 55 | +- MySQL: https://jsr-probitas.github.io/documents/api/client-sql-mysql/index.md |
| 56 | +- SQLite: https://jsr-probitas.github.io/documents/api/client-sql-sqlite/index.md |
| 57 | +- DuckDB: https://jsr-probitas.github.io/documents/api/client-sql-duckdb/index.md |
| 58 | +- Redis: https://jsr-probitas.github.io/documents/api/client-redis/index.md |
| 59 | +- MongoDB: https://jsr-probitas.github.io/documents/api/client-mongodb/index.md |
| 60 | +- Deno KV: https://jsr-probitas.github.io/documents/api/client-deno-kv/index.md |
| 61 | +- RabbitMQ: https://jsr-probitas.github.io/documents/api/client-rabbitmq/index.md |
| 62 | +- SQS: https://jsr-probitas.github.io/documents/api/client-sqs/index.md |
| 63 | + |
| 64 | +Core API: |
| 65 | + |
| 66 | +- Scenario: https://jsr-probitas.github.io/documents/api/scenario/index.md |
| 67 | +- Expect: https://jsr-probitas.github.io/documents/api/expect/index.md |
0 commit comments