brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
mswMock Service Worker API mocking, request handlers, and integration testing.
Independent GitHub snapshot · Automated classification · Original documentation governs
name: msw description: Mock Service Worker API mocking, request handlers, and integration testing. allowed-tools: Read, Write, Edit, Bash, Glob, Grep graph: domains: [domain:web-development] specializations: [specialization:web-development] skillAreas: [skill-area:react-testing, skill-area:service-mocking] roles: [role:frontend-engineer, role:qa-engineer] topics: [topic:test-driven-development]
Expert assistance for API mocking with Mock Service Worker.
import { http, HttpResponse } from 'msw';
export const handlers = [
http.get('/api/users', () => {
return HttpResponse.json([
{ id: '1', name: 'John' },
{ id: '2', name: 'Jane' },
]);
}),
http.post('/api/users', async ({ request }) => {
const body = await request.json();
return HttpResponse.json({ id: '3', ...body }, { status: 201 });
}),
http.get('/api/users/:id', ({ params }) => {
return HttpResponse.json({ id: params.id, name: 'John' });
}),
];
import { setupServer } from 'msw/node';
import { handlers } from './handlers';
const server = setupServer(...handlers);
beforeAll(() => server.listen());
afterEach(() => server.resetHandlers());
afterAll(() => server.close());