Create effective mocks and stubs
Isolate tests from external dependencies
Paste in your AI
Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.
I need to mock [EXTERNAL_SERVICE: third-party API, database, file system] for [MODULE_NAME] tests. Show me how to create mocks with [Jest/Vitest] that: simulate normal and error responses, are reusable across tests, make no real network calls, and verify that the code properly calls the right methods with the right arguments.
Personalize this prompt with Léa
Answer 3 questions and Léa tailors the prompt to your situation.
Use Cases
Learn more
Check the full skill on Prompt Guide to master this technique from A to Z.
View on Prompt Guide📬 Get new prompts every week
Join our newsletter and never miss a prompt.
Similar Prompts
Generate Mocks and Fixtures for Your Automated Tests
A prompt to automatically generate realistic mocks, stubs and data fixtures adapted to your test framework and use cases.
REST API for ML Model
Exposing a model via an API
Automatically Generate Unit Tests with AI
Automatically generate an exhaustive unit test suite covering nominal cases, edge cases, and error cases for any source code.
Analyze and Optimize Algorithmic Complexity
Analyze the Big O complexity of your algorithms and optimize them with appropriate data structures and more efficient algorithms.