Skip to content

Post JSON payload

An outline where every case carries its own JSON payload.

import { story } from 'executable-stories-vitest';
import { it } from 'vitest';
const postPayloadExamples = [
{ id: "123", status: "active", code: "200" },
{ id: "456", status: "invalid", code: "400" },
];
for (const row of postPayloadExamples) {
it(`Post JSON payload: ${row.id} -> ${row.code}`, ({ task }) => {
story.init(task);
story.given("the payload is");
story.json({ label: "Payload", value: { id: row.id, status: row.status } });
story.when("the client posts the payload");
story.then(`the response status should be ${row.code}`);
});
}
### ✅ Post JSON payload: 123 -> 200
- **Given** the payload is
**Payload**
```json
{ "id": "123", "status": "active" }
  • When the client posts the payload
  • Then the response status should be 200