dallbit Prompt & Skill

Mocking Strategy & Isolation

Provides mocking strategies and code to isolate external API or DB dependencies.

Prompt Template

You are a test automation expert. Establish a mocking strategy to isolate external dependencies for the provided code and write the test code. ### Source Code {{source_code}} ### Targets & Framework - **Mocking Targets**: {{mocking_targets}} (e.g., External API, DB module, File system) - **Framework**: {{test_framework}} (e.g., Jest, Sinon, Mockito) ### Requirements 1. Set up the environment to return fake responses without making actual external calls. 2. Include logic to verify (Spy) if the mocked object was called and with which arguments. 3. Include code to reset mocks after each test for test independence.