Skip to content

Bulk user creation

Attach a data table to the Given setup and to the expected result with story.table().

import { story } from 'executable-stories-vitest';
import { describe, it } from 'vitest';
describe('Users', () => {
it('Bulk user creation', ({ task }) => {
story.init(task);
story.given('the following users exist');
story.table({
label: 'Users',
columns: ['email', 'role', 'status'],
rows: [
['alice@example.com', 'admin', 'active'],
['bob@example.com', 'user', 'active'],
['eve@example.com', 'user', 'locked'],
],
});
story.when('the admin opens the user list');
story.then('the user list should include');
story.table({
label: 'Expected',
columns: ['email', 'role', 'status'],
rows: [
['alice@example.com', 'admin', 'active'],
['bob@example.com', 'user', 'active'],
['eve@example.com', 'user', 'locked'],
],
});
});
});
### ✅ Bulk user creation
- **Given** the following users exist
**Users**
| email | role | status |
| ----------------- | ----- | ------ |
| alice@example.com | admin | active |
| bob@example.com | user | active |
| eve@example.com | user | locked |
- **When** the admin opens the user list
- **Then** the user list should include
**Expected**
| email | role | status |
| ----------------- | ----- | ------ |
| alice@example.com | admin | active |
| bob@example.com | user | active |
| eve@example.com | user | locked |