{"name":"@crewd/testing-patterns","version":"1.0.0","type":"skill","description":"Language-agnostic patterns for fast, deterministic, maintainable tests.","integrity":"sha256-3e101c8ffa97b52bbd713dcebb8adeb2a8e2b1cc8cceef3ae4628a0fee0b449f","tarball_url":"https://localhost:3000/api/v1/tarballs/crewd/testing-patterns/1.0.0","tarballUrl":"https://localhost:3000/api/v1/tarballs/crewd/testing-patterns/1.0.0","size_bytes":311,"hosts":["claude-code","cursor","gemini-cli"],"manifest":{"name":"@crewd/testing-patterns","type":"skill","entry":"SKILL.md","hosts":["claude-code","cursor","gemini-cli"],"schema":"https://crewd.dev/schema/skill/v1","content":"---\nname: testing-patterns\ndescription: \"Language-agnostic patterns for fast, deterministic, maintainable tests.\"\n---\n\n# Testing Patterns\n\nUse this skill whenever you write or fix tests.\n\n## Structure: Arrange / Act / Assert\n\nEach test sets up state, performs **one** action, then asserts outcomes. Name tests after behaviour:\n`returns_404_when_user_missing`, not `test_get_user_2`.\n\n## Table-driven tests\n\nWhen several inputs exercise the same logic, use a table (Go `[]struct{...}`, pytest `parametrize`, Jest `test.each`).\nInclude the edge cases: empty, zero, max, invalid, unicode, duplicate.\n\n## Test doubles\n\n| Double | Use when |\n| :--- | :--- |\n| Fake (in-memory impl) | Default choice for repos, clocks, queues |\n| Stub | You only need canned return values |\n| Mock (verify calls) | The interaction itself is the behaviour (e.g. \"email is sent once\") |\n\nInject time, randomness, network and filesystem; never call them directly in code under test.\n\n## Determinism rules\n\n- No `sleep` — use fake clocks or poll with a timeout.\n- No real network; use local test servers (`httptest`, `msw`, `responses`).\n- Tests must pass in any order and in parallel.\n- Use temp dirs, never the user's home or repo root.\n\n## Regression tests for bugs\n\n1. Write a test that reproduces the bug and **fails**.\n2. Fix the code.\n3. Confirm the test passes and keep it, named after the bug/issue.\n\n## Coverage\n\nAim for meaningful coverage of branches and error paths in business logic; don't chase 100% on glue code.\n","version":"1.0.0","description":"Language-agnostic patterns for fast, deterministic, maintainable tests."},"scripts":[],"dependencies":[],"deprecated":null,"created_at":"2026-10-18T17:02:35.61008+00:00"}