[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M72S6XYA5QDZWGJDBDW5Q12E":3,"skill-same:01M72S6XYA5QDZWGJDBDW5Q12E":46},{"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":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M72S6XYA5QDZWGJDBDW5Q12E","testing-guide",null,"Testing reference for quantum-vault: unit (Vitest), component integration (Vitest + Testing Library), and end-to-end (Playwright). Describes what to test, where, how to keep selectors stable, and how to run each layer.","p-11\u002Fquantum-vault","p-11","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F187643446?v=4","01M72S62G38VYPMH9WSPQHE8MA","Project Eleven","01M72S62H61Y0MHGKSG7JTBZ1D",3,"MIT","https:\u002F\u002Fgithub.com\u002Fp-11\u002Fquantum-vault\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Ftesting-guide\u002FSKILL.md",[],[],"2026-11-10 22:39:42",false,"---\nname: testing-guide\ndescription: >-\n  Testing reference for quantum-vault: unit (Vitest), component integration (Vitest +\n  Testing Library), and end-to-end (Playwright). Describes what to test, where, how to\n  keep selectors stable, and how to run each layer.\n---\n\n# Testing Guide\n\n## Decision Tree\n\n```\nPure function (mapper, util, core logic)?\n  -> UNIT TEST (Vitest)\n\nHook composing queries or state?\n  -> HOOK TEST (Vitest + renderHook)\n\nComponent with user interaction?\n  -> COMPONENT TEST (Vitest + Testing Library)\n\nNew user-facing screen or critical flow?\n  -> E2E TEST (Playwright)\n\nStyled component with no logic?\n  -> SKIP (no tests needed)\n```\n\n### When to skip\n\n- Pure UI components with zero logic (just prop rendering)\n- Config files, type-only files, barrel exports\n- Changes under ~5 lines that modify existing tested behavior (extend an existing test instead)\n\n## Running Tests\n\n```bash\npnpm test:unit                                           # Vitest - unit + integration, run once\npnpm test:unit:watch                                     # Vitest - watch mode\npnpm test:e2e:check                                      # Playwright - parse + list tests\npnpm exec playwright test                                # Playwright - run everything\npnpm exec playwright test __tests__\u002Fe2e\u002Fwallet.test.ts   # Playwright - one file\n```\n\n`pnpm ci:pr` runs lint, prettier, `test:unit`, `build:dev`, `test:e2e:check`, and the `dep-doc` audit as the final PR gate.\n\n---\n\n## Unit Tests\n\n### What to Test\n\n- **Mappers** - API or libqc response transformations\n- **Utilities** - pure functions in `src\u002Flib\u002F`\n- **Core logic** - business rules, BigNumber \u002F `big.js` math, formatting\n- **Validation** - schema edge cases and error paths\n- **Reducers and pure resolvers** - Record-driven dispatch tables\n\n### Structure\n\n```typescript\nimport { describe, expect, it } from 'vitest'\n\nimport { formatWalletAddress } from '.\u002Fformat-wallet-address'\n\ndescribe('formatWalletAddress', () => {\n  it('truncates the middle with default start and end lengths', () => {\n    const result = formatWalletAddress(\n      '0xabcdef1234567890abcdef1234567890abcdef12'\n    )\n    expect(result).toBe('0xabcd...ef12')\n  })\n\n  it('respects custom start and end lengths', () => {\n    const result = formatWalletAddress(\n      '0xabcdef1234567890abcdef1234567890abcdef12',\n      { start: 8, end: 6 }\n    )\n    expect(result).toBe('0xabcdef1...cdef12')\n  })\n})\n```\n\n### Principles\n\n- Arrange-Act-Assert\n- Assert on the observable result, not internal state\n- Cover edge cases: empty, zero, boundary conditions, error paths\n- Use factory helpers for test data (colocated in `__tests__\u002Ffactories\u002F`)\n- Never mock pure functions - they are the thing you are testing\n\n---\n\n## Hook Tests\n\nUse `renderHook` from `@testing-library\u002Freact`. Wrap providers explicitly in a test-only wrapper:\n\n```typescript\nimport { renderHook, waitFor } from '@testing-library\u002Freact'\nimport { describe, expect, it } from 'vitest'\n\nimport { TestProviders } from '..\u002F..\u002F__tests__\u002Fproviders'\n\nimport { useCoinBalance } from '.\u002Fuse-coin-balance'\n\ndescribe('useCoinBalance', () => {\n  it('resolves with a formatted balance', async () => {\n    const { result } = renderHook(() => useCoinBalance(mockCoin), {\n      wrapper: TestProviders\n    })\n\n    await waitFor(() => expect(result.current.data).toBeDefined())\n\n    expect(result.current.data).toEqual({ formatted: '1.2345', raw: 1234500n })\n  })\n})\n```\n\nPrinciples:\n\n- Test the public hook contract, not the implementation\n- Trigger realistic consumer behavior (loading -> success, loading -> error)\n- Mock libqc at the seam (a thin test double of the functions you use), never via deep-import spies\n\n---\n\n## Component Tests\n\nUse `@testing-library\u002Freact` with user-event. Query by role and name when possible, fall back to `data-testid` for purely visual nodes.\n\n```typescript\nimport { render, screen } from '@testing-library\u002Freact'\nimport userEvent from '@testing-library\u002Fuser-event'\nimport { describe, expect, it } from 'vitest'\n\nimport { TestProviders } from '..\u002F..\u002F__tests__\u002Fproviders'\nimport { SendAmountInput } from '.\u002Fsend-amount-input'\n\ndescribe('\u003CSendAmountInput \u002F>', () => {\n  it('calls onChange with the typed value', async () => {\n    const user = userEvent.setup()\n    const onChange = vi.fn()\n    render(\u003CSendAmountInput value=\"\" onChange={onChange} \u002F>, { wrapper: TestProviders })\n\n    await user.type(screen.getByLabelText('Amount'), '1.23')\n\n    expect(onChange).toHaveBeenLastCalledWith('1.23')\n  })\n})\n```\n\nPrinciples:\n\n- Assert on text\u002Frole users see, not on CSS classes\n- Use `data-testid` only for visual-only elements (icons, spacers)\n- Keep assertions behavior-focused (disabled? visible? correct text?)\n- Prefer `waitFor` over fixed `setTimeout`\n\n---\n\n## End-to-End Tests\n\nE2E runs against a built extension via Playwright. Tests live in `__tests__\u002Fe2e\u002F`.\n\n### Running\n\n```bash\npnpm exec playwright test                                  # all specs\npnpm exec playwright test __tests__\u002Fe2e\u002Fwallet.test.ts     # one spec\npnpm test:e2e:check                                        # verify specs parse (CI gate)\n```\n\n### Structure\n\nFollow the pattern in `__tests__\u002Fe2e\u002Fwallet.test.ts`. Shared helpers belong in `__tests__\u002Ftest-utils.ts`.\n\n### Selector Stability Rules\n\n- Preserve existing `data-testid` values and visible labels that tests rely on\n- If a label or testid must change, update the E2E test in the same PR\n- Prefer visible text or role-based assertions over CSS selectors\n- Never assert on computed styles from E2E - inspect the DOM state instead\n\n### Determinism\n\n- Avoid fixed `setTimeout` and animation-length waits - use Playwright auto-waiting and state assertions\n- Mock chain RPC reads when the test does not need real network behavior (see existing test scaffolding)\n- Tests must be independent - no shared mutable state between specs\n\n---\n\n## What to Test Matrix\n\n| What was built                          | Test type                                                 |\n| --------------------------------------- | --------------------------------------------------------- |\n| Pure utility \u002F mapper                   | Unit (Vitest)                                             |\n| `big.js` calculation                    | Unit with edge cases (zero, negative, overflow)           |\n| Custom hook with state                  | Hook (`renderHook`)                                       |\n| Interactive component                   | Component (Testing Library)                               |\n| New screen or critical flow             | E2E (Playwright)                                          |\n| libqc integration seam                  | Unit against a mock of `LibQC`                            |\n| Config \u002F types \u002F barrel                 | Skip                                                      |\n\n## Rules\n\n- Fix the code, not the test (unless the spec genuinely changed)\n- Test behavior, not implementation\n- Keep tests focused - one intent per `it` block\n- Tests must be deterministic - no flaky timing, no real network unless E2E\n- Do not assert on framework or library internals\n- Reset any shared state between tests (factories + fresh providers)\n","# Testing Guide\n\n## Decision Tree\n\n```\nPure function (mapper, util, core logic)?\n  -> UNIT TEST (Vitest)\n\nHook composing queries or state?\n  -> HOOK TEST (Vitest + renderHook)\n\nComponent with user interaction?\n  -> COMPONENT TEST (Vitest + Testing Library)\n\nNew user-facing screen or critical flow?\n  -> E2E TEST (Playwright)\n\nStyled component with no logic?\n  -> SKIP (no tests needed)\n```\n\n### When to skip\n\n- Pure UI components with zero logic (just prop rendering)\n- Config files, type-only files, barrel exports\n- Changes under ~5 lines that modify existing tested behavior (extend an existing test instead)\n\n## Running Tests\n\n```bash\npnpm test:unit                                           # Vitest - unit + integration, run once\npnpm test:unit:watch                                     # Vitest - watch mode\npnpm test:e2e:check                                      # Playwright - parse + list tests\npnpm exec playwright test                                # Playwright - run everything\npnpm exec playwright test __tests__\u002Fe2e\u002Fwallet.test.ts   # Playwright - one file\n```\n\n`pnpm ci:pr` runs lint, prettier, `test:unit`, `build:dev`, `test:e2e:check`, and the `dep-doc` audit as the final PR gate.\n\n---\n\n## Unit Tests\n\n### What to Test\n\n- **Mappers** - API or libqc response transformations\n- **Utilities** - pure functions in `src\u002Flib\u002F`\n- **Core logic** - business rules, BigNumber \u002F `big.js` math, formatting\n- **Validation** - schema edge cases and error paths\n- **Reducers and pure resolvers** - Record-driven dispatch tables\n\n### Structure\n\n```typescript\nimport { describe, expect, it } from 'vitest'\n\nimport { formatWalletAddress } from '.\u002Fformat-wallet-address'\n\ndescribe('formatWalletAddress', () => {\n  it('truncates the middle with default start and end lengths', () => {\n    const result = formatWalletAddress(\n      '0xabcdef1234567890abcdef1234567890abcdef12'\n    )\n    expect(result).toBe('0xabcd...ef12')\n  })\n\n  it('respects custom start and end lengths', () => {\n    const result = formatWalletAddress(\n      '0xabcdef1234567890abcdef1234567890abcdef12',\n      { start: 8, end: 6 }\n    )\n    expect(result).toBe('0xabcdef1...cdef12')\n  })\n})\n```\n\n### Principles\n\n- Arrange-Act-Assert\n- Assert on the observable result, not internal state\n- Cover edge cases: empty, zero, boundary conditions, error paths\n- Use factory helpers for test data (colocated in `__tests__\u002Ffactories\u002F`)\n- Never mock pure functions - they are the thing you are testing\n\n---\n\n## Hook Tests\n\nUse `renderHook` from `@testing-library\u002Freact`. Wrap providers explicitly in a test-only wrapper:\n\n```typescript\nimport { renderHook, waitFor } from '@testing-library\u002Freact'\nimport { describe, expect, it } from 'vitest'\n\nimport { TestProviders } from '..\u002F..\u002F__tests__\u002Fproviders'\n\nimport { useCoinBalance } from '.\u002Fuse-coin-balance'\n\ndescribe('useCoinBalance', () => {\n  it('resolves with a formatted balance', async () => {\n    const { result } = renderHook(() => useCoinBalance(mockCoin), {\n      wrapper: TestProviders\n    })\n\n    await waitFor(() => expect(result.current.data).toBeDefined())\n\n    expect(result.current.data).toEqual({ formatted: '1.2345', raw: 1234500n })\n  })\n})\n```\n\nPrinciples:\n\n- Test the public hook contract, not the implementation\n- Trigger realistic consumer behavior (loading -> success, loading -> error)\n- Mock libqc at the seam (a thin test double of the functions you use), never via deep-import spies\n\n---\n\n## Component Tests\n\nUse `@testing-library\u002Freact` with user-event. Query by role and name when possible, fall back to `data-testid` for purely visual nodes.\n\n```typescript\nimport { render, screen } from '@testing-library\u002Freact'\nimport userEvent from '@testing-library\u002Fuser-event'\nimport { describe, expect, it } from 'vitest'\n\nimport { TestProviders } from '..\u002F..\u002F__tests__\u002Fproviders'\nimport { SendAmountInput } from '.\u002Fsend-amount-input'\n\ndescribe('\u003CSendAmountInput \u002F>', () => {\n  it('calls onChange with the typed value', async () => {\n    const user = userEvent.setup()\n    const onChange = vi.fn()\n    render(\u003CSendAmountInput value=\"\" onChange={onChange} \u002F>, { wrapper: TestProviders })\n\n    await user.type(screen.getByLabelText('Amount'), '1.23')\n\n    expect(onChange).toHaveBeenLastCalledWith('1.23')\n  })\n})\n```\n\nPrinciples:\n\n- Assert on text\u002Frole users see, not on CSS classes\n- Use `data-testid` only for visual-only elements (icons, spacers)\n- Keep assertions behavior-focused (disabled? visible? correct text?)\n- Prefer `waitFor` over fixed `setTimeout`\n\n---\n\n## End-to-End Tests\n\nE2E runs against a built extension via Playwright. Tests live in `__tests__\u002Fe2e\u002F`.\n\n### Running\n\n```bash\npnpm exec playwright test                                  # all specs\npnpm exec playwright test __tests__\u002Fe2e\u002Fwallet.test.ts     # one spec\npnpm test:e2e:check                                        # verify specs parse (CI gate)\n```\n\n### Structure\n\nFollow the pattern in `__tests__\u002Fe2e\u002Fwallet.test.ts`. Shared helpers belong in `__tests__\u002Ftest-utils.ts`.\n\n### Selector Stability Rules\n\n- Preserve existing `data-testid` values and visible labels that tests rely on\n- If a label or testid must change, update the E2E test in the same PR\n- Prefer visible text or role-based assertions over CSS selectors\n- Never assert on computed styles from E2E - inspect the DOM state instead\n\n### Determinism\n\n- Avoid fixed `setTimeout` and animation-length waits - use Playwright auto-waiting and state assertions\n- Mock chain RPC reads when the test does not need real network behavior (see existing test scaffolding)\n- Tests must be independent - no shared mutable state between specs\n\n---\n\n## What to Test Matrix\n\n| What was built                          | Test type                                                 |\n| --------------------------------------- | --------------------------------------------------------- |\n| Pure utility \u002F mapper                   | Unit (Vitest)                                             |\n| `big.js` calculation                    | Unit with edge cases (zero, negative, overflow)           |\n| Custom hook with state                  | Hook (`renderHook`)                                       |\n| Interactive component                   | Component (Testing Library)                               |\n| New screen or critical flow             | E2E (Playwright)                                          |\n| libqc integration seam                  | Unit against a mock of `LibQC`                            |\n| Config \u002F types \u002F barrel                 | Skip                                                      |\n\n## Rules\n\n- Fix the code, not the test (unless the spec genuinely changed)\n- Test behavior, not implementation\n- Keep tests focused - one intent per `it` block\n- Tests must be deterministic - no flaky timing, no real network unless E2E\n- Do not assert on framework or library internals\n- Reset any shared state between tests (factories + fresh providers)\n",{"name":5,"description":7},"main","94843b628446f86d412a5c5661cf42a26c828b51",".claude\u002Fskills\u002Ftesting-guide","https:\u002F\u002Fgithub.com\u002Fp-11\u002Fquantum-vault","https:\u002F\u002Fgithub.com\u002Fp-11","https:\u002F\u002Fwww.projecteleven.com","Securing digital assets for the post-quantum era","2026-10-22 17:23:20",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add p-11\u002Fquantum-vault --skill testing-guide",{"tool":38,"command":39},"bunx","bunx skills add p-11\u002Fquantum-vault --skill testing-guide",{"tool":41,"command":42},"pnpm","pnpm dlx skills add p-11\u002Fquantum-vault --skill testing-guide","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fp-11\u002Fquantum-vault\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Ftesting-guide\u002FSKILL.md",true,[],[47,53,59,65,71,77],{"skillNo":48,"name":49,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":19},"01M72S75MAGAJ9BT5N5CM75TJ1","resolve-pr-comments","https:\u002F\u002Fgithub.com\u002Fp-11\u002Fquantum-vault\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fresolve-pr-comments\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M72S74P33WDYNZZVQB9PPSYQ","orchestrate","https:\u002F\u002Fgithub.com\u002Fp-11\u002Fquantum-vault\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Forchestrate\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M72S73TEY2KR8F7ZKKWE1BTA","finish","https:\u002F\u002Fgithub.com\u002Fp-11\u002Fquantum-vault\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Ffinish\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M72S72X56SDNX8TGRV3MHB5J","figma","https:\u002F\u002Fgithub.com\u002Fp-11\u002Fquantum-vault\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Ffigma\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M72S7218NT062SK66MMZJYJD","delegate","https:\u002F\u002Fgithub.com\u002Fp-11\u002Fquantum-vault\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fdelegate\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M72S7144W92BM272E9CDAJM6","commit","https:\u002F\u002Fgithub.com\u002Fp-11\u002Fquantum-vault\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fcommit\u002FSKILL.md",[],[]]