[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7B31YPERZ42RNXWRN0FYCGV":3,"skill-same:01M7B31YPERZ42RNXWRN0FYCGV":78},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7B31YPERZ42RNXWRN0FYCGV","hamster-testing",null,"Testing patterns for unit tests (Jest), integration tests, E2E tests (Playwright). Use when writing app-level tests, setting up test infrastructure, or implementing TDD workflows. For database testing (RLS, constraints, triggers, schema), use hamster-database-testing instead.","gethamster\u002Fskills","gethamster","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F215697643?v=4","01M7B2R6PGB3SDZZ71E0WE2S74","Hamster","01M7B2R6Q21HWJRXZZWB78BNDG",4,"MIT","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002F.experimental\u002Fhamster-testing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: hamster-testing\ndescription: \"Testing patterns for unit tests (Jest), integration tests, E2E tests (Playwright). Use when writing app-level tests, setting up test infrastructure, or implementing TDD workflows. For database testing (RLS, constraints, triggers, schema), use hamster-database-testing instead.\"\nversion: \"1.1.0\"\n---\n\n# Hamster Testing Patterns\n\n## Quick Reference\n\n| Task | Pattern | Reference |\n| --- | --- | --- |\n| Write unit test (NestJS) | Jest with mocking | [unit-testing.md](references\u002Funit-testing.md) |\n| Write integration test | Supertest + real DB | [integration-testing.md](references\u002Fintegration-testing.md) |\n| Write E2E test | Playwright + Page Objects | [e2e-testing.md](references\u002Fe2e-testing.md) |\n| Follow TDD workflow | Red → Green → Refactor | [tdd-workflow.md](references\u002Ftdd-workflow.md) |\n| Mock dependencies | Jest mocking patterns | [mocking-patterns.md](references\u002Fmocking-patterns.md) |\n| **Database testing** | **See** [**hamster-database-testing**](..\u002Fhamster-database-testing\u002FSKILL.md) | Vitest (RLS\u002Fconstraints) + pgTAP (triggers\u002Fschema) |\n\n## When to Apply\n\n- Writing new tests for features\n- Setting up test infrastructure\n- Debugging failing tests\n- Implementing TDD workflow\n- Adding E2E tests for critical paths\n\n> **Database testing?** Use the [hamster-database-testing](..\u002Fhamster-database-testing\u002FSKILL.md) skill instead — it covers both Vitest and pgTAP with a decision guide.\n\n## Test Types Overview\n\n| Type | Location | Purpose | Tools |\n| --- | --- | --- | --- |\n| Unit | `*.test.ts` next to source | Test isolated functions | Jest |\n| Integration | `tests\u002Fintegration\u002F` | Test component interactions | Jest + Supertest |\n| E2E | `apps\u002Fe2e\u002Ftests\u002F` | Test user journeys | Playwright |\n\n## Coverage Standards\n\n| Scope | Lines | Branches | Functions |\n| --- | --- | --- | --- |\n| Global minimum | 80% | 70% | 80% |\n| Critical code (utils) | 90% | 85% | 90% |\n| New features | Must meet global | Must meet global | Must meet global |\n\n## Commands\n\n```bash\n# Unit tests\npnpm test                          # All tests\npnpm --filter hamster-ai test             # API unit tests\npnpm --filter hamster-ai test:watch       # Watch mode\n\n# E2E tests\npnpm --filter e2e test             # All E2E tests\npnpm --filter e2e test:ui          # Interactive UI mode\npnpm --filter e2e test:debug       # Debug mode\n\n# Coverage\npnpm --filter hamster-ai test:cov         # Coverage report\n```\n\n## Key Patterns\n\n### Unit Test Structure\n\n```typescript\ndescribe('ServiceName', () => {\n  let service: ServiceName;\n\n  beforeEach(() => {\n    jest.clearAllMocks();\n    service = new ServiceName(mockDependency);\n  });\n\n  describe('methodName', () => {\n    it('should handle normal case', () => {\n      const result = service.methodName(validInput);\n      expect(result).toBe(expected);\n    });\n\n    it('should throw for invalid input', () => {\n      expect(() => service.methodName(invalidInput))\n        .toThrow('Expected error');\n    });\n  });\n});\n```\n\n### E2E Test with Page Object\n\n```typescript\ntest.describe('Feature', () => {\n  let pageObject: FeaturePageObject;\n\n  test.beforeEach(async ({ page }) => {\n    pageObject = new FeaturePageObject(page);\n    await pageObject.goto();\n  });\n\n  test('user can complete action', async () => {\n    await pageObject.performAction();\n    await pageObject.expectSuccess();\n  });\n});\n```\n\n### Reliable Async Operations\n\n```typescript\n\u002F\u002F Use toPass() for flaky operations (network, email, OTP)\nawait expect(async () => {\n  const response = await page.waitForResponse(r => r.url().includes('\u002Fapi'));\n  expect(response.status()).toBe(200);\n}).toPass();\n```\n\n## Critical Rules\n\n1. **AAA Pattern** - Arrange, Act, Assert in every test\n2. **Test Independence** - Each test must work in isolation\n3. **No Arbitrary Waits** - Use proper wait strategies, never `waitForTimeout()`\n4. **Page Objects for E2E** - Encapsulate selectors and actions\n5. **data-test Selectors** - Use `data-test=\"...\"` attributes for stability\n6. **Mock External Deps** - Never hit real external services in unit tests\n7. **Clean Up** - Use `afterEach`\u002F`afterAll` for cleanup\n\n## References\n\n- [unit-testing.md](references\u002Funit-testing.md) - Jest unit testing patterns\n- [integration-testing.md](references\u002Fintegration-testing.md) - Integration testing with real DB\n- [e2e-testing.md](references\u002Fe2e-testing.md) - Playwright E2E patterns\n- [tdd-workflow.md](references\u002Ftdd-workflow.md) - TDD development workflow\n- [mocking-patterns.md](references\u002Fmocking-patterns.md) - Jest mocking patterns\n- [hamster-database-testing](..\u002Fhamster-database-testing\u002FSKILL.md) - Database testing (Vitest + pgTAP)\n\n## Key Files\n\n| File | Purpose |\n| --- | --- |\n| `apps\u002Fai\u002Fjest.config.ts` | API Jest configuration |\n| `apps\u002Fe2e\u002Fplaywright.config.ts` | Playwright configuration |\n| `apps\u002Fe2e\u002Ftests\u002F` | E2E test files |\n| `apps\u002Fe2e\u002Ftests\u002Fpage-objects\u002F` | Page Object classes |\n","# Hamster Testing Patterns\n\n## Quick Reference\n\n| Task | Pattern | Reference |\n| --- | --- | --- |\n| Write unit test (NestJS) | Jest with mocking | [unit-testing.md](references\u002Funit-testing.md) |\n| Write integration test | Supertest + real DB | [integration-testing.md](references\u002Fintegration-testing.md) |\n| Write E2E test | Playwright + Page Objects | [e2e-testing.md](references\u002Fe2e-testing.md) |\n| Follow TDD workflow | Red → Green → Refactor | [tdd-workflow.md](references\u002Ftdd-workflow.md) |\n| Mock dependencies | Jest mocking patterns | [mocking-patterns.md](references\u002Fmocking-patterns.md) |\n| **Database testing** | **See** [**hamster-database-testing**](..\u002Fhamster-database-testing\u002FSKILL.md) | Vitest (RLS\u002Fconstraints) + pgTAP (triggers\u002Fschema) |\n\n## When to Apply\n\n- Writing new tests for features\n- Setting up test infrastructure\n- Debugging failing tests\n- Implementing TDD workflow\n- Adding E2E tests for critical paths\n\n> **Database testing?** Use the [hamster-database-testing](..\u002Fhamster-database-testing\u002FSKILL.md) skill instead — it covers both Vitest and pgTAP with a decision guide.\n\n## Test Types Overview\n\n| Type | Location | Purpose | Tools |\n| --- | --- | --- | --- |\n| Unit | `*.test.ts` next to source | Test isolated functions | Jest |\n| Integration | `tests\u002Fintegration\u002F` | Test component interactions | Jest + Supertest |\n| E2E | `apps\u002Fe2e\u002Ftests\u002F` | Test user journeys | Playwright |\n\n## Coverage Standards\n\n| Scope | Lines | Branches | Functions |\n| --- | --- | --- | --- |\n| Global minimum | 80% | 70% | 80% |\n| Critical code (utils) | 90% | 85% | 90% |\n| New features | Must meet global | Must meet global | Must meet global |\n\n## Commands\n\n```bash\n# Unit tests\npnpm test                          # All tests\npnpm --filter hamster-ai test             # API unit tests\npnpm --filter hamster-ai test:watch       # Watch mode\n\n# E2E tests\npnpm --filter e2e test             # All E2E tests\npnpm --filter e2e test:ui          # Interactive UI mode\npnpm --filter e2e test:debug       # Debug mode\n\n# Coverage\npnpm --filter hamster-ai test:cov         # Coverage report\n```\n\n## Key Patterns\n\n### Unit Test Structure\n\n```typescript\ndescribe('ServiceName', () => {\n  let service: ServiceName;\n\n  beforeEach(() => {\n    jest.clearAllMocks();\n    service = new ServiceName(mockDependency);\n  });\n\n  describe('methodName', () => {\n    it('should handle normal case', () => {\n      const result = service.methodName(validInput);\n      expect(result).toBe(expected);\n    });\n\n    it('should throw for invalid input', () => {\n      expect(() => service.methodName(invalidInput))\n        .toThrow('Expected error');\n    });\n  });\n});\n```\n\n### E2E Test with Page Object\n\n```typescript\ntest.describe('Feature', () => {\n  let pageObject: FeaturePageObject;\n\n  test.beforeEach(async ({ page }) => {\n    pageObject = new FeaturePageObject(page);\n    await pageObject.goto();\n  });\n\n  test('user can complete action', async () => {\n    await pageObject.performAction();\n    await pageObject.expectSuccess();\n  });\n});\n```\n\n### Reliable Async Operations\n\n```typescript\n\u002F\u002F Use toPass() for flaky operations (network, email, OTP)\nawait expect(async () => {\n  const response = await page.waitForResponse(r => r.url().includes('\u002Fapi'));\n  expect(response.status()).toBe(200);\n}).toPass();\n```\n\n## Critical Rules\n\n1. **AAA Pattern** - Arrange, Act, Assert in every test\n2. **Test Independence** - Each test must work in isolation\n3. **No Arbitrary Waits** - Use proper wait strategies, never `waitForTimeout()`\n4. **Page Objects for E2E** - Encapsulate selectors and actions\n5. **data-test Selectors** - Use `data-test=\"...\"` attributes for stability\n6. **Mock External Deps** - Never hit real external services in unit tests\n7. **Clean Up** - Use `afterEach`\u002F`afterAll` for cleanup\n\n## References\n\n- [unit-testing.md](references\u002Funit-testing.md) - Jest unit testing patterns\n- [integration-testing.md](references\u002Fintegration-testing.md) - Integration testing with real DB\n- [e2e-testing.md](references\u002Fe2e-testing.md) - Playwright E2E patterns\n- [tdd-workflow.md](references\u002Ftdd-workflow.md) - TDD development workflow\n- [mocking-patterns.md](references\u002Fmocking-patterns.md) - Jest mocking patterns\n- [hamster-database-testing](..\u002Fhamster-database-testing\u002FSKILL.md) - Database testing (Vitest + pgTAP)\n\n## Key Files\n\n| File | Purpose |\n| --- | --- |\n| `apps\u002Fai\u002Fjest.config.ts` | API Jest configuration |\n| `apps\u002Fe2e\u002Fplaywright.config.ts` | Playwright configuration |\n| `apps\u002Fe2e\u002Ftests\u002F` | E2E test files |\n| `apps\u002Fe2e\u002Ftests\u002Fpage-objects\u002F` | Page Object classes |\n",{"name":5,"version":24,"description":7},"1.1.0","main","fe3bb1476c3ec23d8a366eac0fa8cd9f0852360a","skills\u002F.experimental\u002Fhamster-testing",0,"https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills","https:\u002F\u002Fgithub.com\u002Fgethamster","https:\u002F\u002Ftryhamster.com","We're building the AI-native future of work, unlocking the promised acceleration for your whole team, from idea to impact.","2026-11-05 11:33:33",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add gethamster\u002Fskills --skill hamster-testing",{"tool":40,"command":41},"bunx","bunx skills add gethamster\u002Fskills --skill hamster-testing",{"tool":43,"command":44},"pnpm","pnpm dlx skills add gethamster\u002Fskills --skill hamster-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002F.experimental\u002Fhamster-testing\u002FSKILL.md",true,[48,54,58,62,66,70,74],{"path":49,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":52,"sourceHtmlUrl":53},"references\u002Fe2e-external-services.md","REFERENCE","参考文档",7153,"https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002F.experimental\u002Fhamster-testing\u002Freferences\u002Fe2e-external-services.md",{"path":55,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":56,"sourceHtmlUrl":57},"references\u002Fe2e-testing.md",7175,"https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002F.experimental\u002Fhamster-testing\u002Freferences\u002Fe2e-testing.md",{"path":59,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":60,"sourceHtmlUrl":61},"references\u002Fflaky-tests.md",13924,"https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002F.experimental\u002Fhamster-testing\u002Freferences\u002Fflaky-tests.md",{"path":63,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":64,"sourceHtmlUrl":65},"references\u002Fintegration-testing.md",6893,"https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002F.experimental\u002Fhamster-testing\u002Freferences\u002Fintegration-testing.md",{"path":67,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":68,"sourceHtmlUrl":69},"references\u002Fmocking-patterns.md",6947,"https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002F.experimental\u002Fhamster-testing\u002Freferences\u002Fmocking-patterns.md",{"path":71,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002Ftdd-workflow.md",6454,"https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002F.experimental\u002Fhamster-testing\u002Freferences\u002Ftdd-workflow.md",{"path":75,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Funit-testing.md",5137,"https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002F.experimental\u002Fhamster-testing\u002Freferences\u002Funit-testing.md",[79,86,93,100,107,114],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7B5MWYW0KE251276S56KQDZ","writing-waterfall-requirements-documents","Write a waterfall requirements document: elicit, structure and review testable, traceable requirements, then baseline the specification before design.","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-waterfall-requirements-documents\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7B5MRCXWWPKREPB1CHQ7H90","writing-vision-and-values-statements","Write a V2MOM vision a reader can test and a ranked list of values that settles real tradeoffs, so the rest of the document has a clear anchor.","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-vision-and-values-statements\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M7B5MKH2CH22YZAHQW3080VQ","writing-system-prompts-for-claude","Write Claude prompts and CLAUDE.md files that supply exact inputs, scope the task, and define done so the first attempt can be checked.","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-system-prompts-for-claude\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":19},"01M7B5ME1Y3X9RNRKP5HKHKACZ","writing-page-specific-website-copy","Website copywriting by page type: write homepage, landing page, pricing page and feature page copy that fits each page's visitor and single job.","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-page-specific-website-copy\u002FSKILL.md",[],[],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":19},"01M7B5M8MQNM8MN8PYH6BVWJ2B","writing-internal-press-releases","How to write an internal press release: the one-page working backwards press release that opens a PR\u002FFAQ document before anything is built.","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-internal-press-releases\u002FSKILL.md",[],[],{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":19},"01M7B5M3P3YH1XF37R8PWXXSBK","writing-email-sequences-that-sell","Email sequence copywriting for nurture and sales: give each email one job, write clear subject lines, and close with one specific call to action.","https:\u002F\u002Fgithub.com\u002Fgethamster\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-email-sequences-that-sell\u002FSKILL.md",[],[]]