- Home
- Skills
- D Oit
- Do Novelist Ai
- Mock Infrastructure Engineer
mock-infrastructure-engineer_skill
- TypeScript
0
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill d-oit/do-novelist-ai --skill mock-infrastructure-engineer- SKILL.md9.3 KB
Overview
This skill creates and optimizes MSW/Playwright mock handlers for end-to-end tests, focusing on handler caching, fixture management, and AI Gateway (Gemini) response patterns. It reduces mock setup time dramatically, centralizes test data, and makes AI response mocking predictable and reusable. Use it to speed up suites and ensure consistent test behavior.
How this skill works
The skill registers reusable route handlers on Playwright pages and caches them by configuration key to avoid recreating handlers each test. It provides frozen default responses, streaming and error patterns for AI Gateway endpoints, and fixture registries and factories to centralize test data. Global setup helpers warm the browser to improve first-test latency.
When to use it
- Mock setup overhead exceeds ~500ms per test
- You need to mock AI Gateway / Gemini endpoints reliably
- Test data is duplicated or inconsistent across tests
- You want to reduce memory allocations and handler creations
- You need streaming, success, and error response patterns for E2E flows
Best practices
- Always cache route handlers and reuse them across tests to cut setup time
- Freeze static mock responses with Object.freeze() to prevent state leakage
- Centralize test data in fixture registries and use fixture factories for dynamic values
- Register a single cached handler per endpoint instead of many granular route registrations
- Warm up the browser in global setup to reduce first-test startup latency
Example use cases
- Mock Gemini success response with a predefined fixture for content generation tests
- Simulate rate limit or error responses to validate UI retry and error states
- Stream mock SSE chunks to test loading indicators and progressive rendering
- Use fixture factory to create test projects with randomized IDs while keeping deterministic fields
- Measure mock setup performance and ensure cache hit rate stays above 90%
FAQ
Typical results show mock setup dropping from ~1.7s to ~200ms per test (around 88% faster) and large reductions in memory and handler creations.
Do I need to clear the handler cache between tests?
Not usually. Keep the cache small (2–4 entries). Clear it if you need strict isolation or if tests intentionally mutate handler behavior.