원클릭으로
mocking-strategies
Mock, patch, fake, and stub patterns for isolating dependencies in Python and JavaScript test suites.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Mock, patch, fake, and stub patterns for isolating dependencies in Python and JavaScript test suites.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Translate natural language image descriptions into detailed, structured DALL-E prompts with subject, style, composition, lighting, and mood specifications.
Decompose mathematical problems into sub-expressions, evaluate each one with the calculator tool, and present the full working chain. Handles arithmetic, trigonometry, logarithms, and financial formulas.
Compare two or more PDF documents by extracting targeted sections, building a structured comparison matrix, and highlighting differences with page references.
Extract structured data from web pages using browser snapshot and text tools, then process it into tables, comparisons, or summaries using Python.
Analyze endpoint latency trends using historical check data from memory. Detects slow degradation, spikes vs sustained issues, and calculates baseline deviations.
Validate API response structure and content. Detects schema drift, unexpected null values, and abnormal response sizes.
| name | mocking-strategies |
| description | Mock, patch, fake, and stub patterns for isolating dependencies in Python and JavaScript test suites. |
Mocking strategies for isolating external dependencies in tests.
Use this skill when tests need to isolate external dependencies such as databases, APIs, filesystems, time, or randomness.
unittest.mock.patch("module.path.ClassName") -- replace an object for
the duration of a test. Use as a decorator or context manager.patch.object(obj, "attr") -- patch a specific attribute on a live
object.MagicMock(spec=RealClass) -- create a mock that mirrors the real class
API; accessing non-existent attributes raises AttributeError.side_effect -- set to a function for dynamic return values, or to an
exception class to simulate errors.return_value -- set the fixed return value of the mock.monkeypatch (pytest built-in) -- set attributes, environment variables,
or dict items for the duration of a test without import-path gymnastics.jest.mock("module") / vi.mock("module") -- auto-mock an entire
module. Provide a factory function for custom behavior.__mocks__/ -- place a file next to node_modules or
the real module to override it project-wide.msw (Mock Service Worker) -- intercept HTTP at the network level for
realistic API mocking without changing application code.datetime.now, Date.now).mock.assert_called_once_with(arg1, arg2),
mock.call_count, mock.call_args_list.expect(fn).toHaveBeenCalledTimes(1),
expect(fn).toHaveBeenCalledWith(arg1, arg2).spec=True (Python) so the mock rejects calls to methods that do not
exist on the real object.open is fine for filesystem isolation, but mocking len is
not).