← ClaudeAtlas

mocking-microcks-typescriptlisted

Use when the mocking-strategy-roster resolved (microcks, TypeScript) — the default mocking strategy that serves a downstream HTTP API from its OpenAPI contract in a Microcks container (@microcks/microcks-testcontainers) for a Vitest gateway integration test. Emits mock wiring only; the business TDD cycle stays with the software-engineer lead.
SebastienDegodez/skraft-plugin · ★ 14 · Testing & QA · score 70
Install: claude install-skill SebastienDegodez/skraft-plugin
# Mocking — Microcks x TypeScript adapter (default) Serves the downstream API from its contract in a Microcks container and points the gateway under test at the mock endpoint. Loaded ONLY when `mocking-strategy-roster` resolved `(microcks, TypeScript)`. **Boundary:** mock wiring + integration-test scaffold only. No business TDD, no provider contract verification. ## Prerequisites - devDependency `@microcks/microcks-testcontainers` (0.3.x, which brings `testcontainers`); Docker reachable from the test run. - The downstream contract (OpenAPI, plus `.apiexamples` when the examples live apart) under `contracts/` or the location the `contract-testing` skill chose. ## Recipe — gateway against the Microcks mock ```ts // tests/integration/{feature}/infrastructure/Http{Feature}Gateway.test.ts // @vitest-environment node import path from 'node:path' import { MicrocksContainer, type StartedMicrocksContainer } from '@microcks/microcks-testcontainers' import { afterAll, beforeAll, describe, expect, it } from 'vitest' import { HttpRatesGateway } from '../../../../src/expenses/infrastructure/HttpRatesGateway' let microcks: StartedMicrocksContainer beforeAll(async () => { microcks = await new MicrocksContainer() .withMainArtifacts([path.resolve('contracts/rates-openapi.yaml')]) .start() }, 120_000) afterAll(async () => { await microcks?.stop() }) describe('HttpRatesGateway', () => { it('should read the rate the contract example returns', async () => { const