[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79A1CGD27HHN29VC2WQZRSB":3,"skill-same:01M79A1CGD27HHN29VC2WQZRSB":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":26,"commitSha":27,"skillDirectory":28,"forksCount":14,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M79A1CGD27HHN29VC2WQZRSB","bun-test-mocking",null,"Use for mock functions in Bun tests, spyOn, mock.module, implementations, and test doubles.","Elogic360\u002Fsoftware-factory","Elogic360","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F156535519?v=4","01M74NH3F0RB13PWB7JZDE2V80","elogic360","01M74NH3FPC65082MDZVMFHDM3",0,"MIT","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fbun\u002Fskills\u002Fbun-test-mocking\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bun-test-mocking\ndescription: Use for mock functions in Bun tests, spyOn, mock.module, implementations, and test doubles.\nmetadata:\n  version: \"1.0.0\"\nlicense: MIT\n---\n\n# Bun Test Mocking\n\nBun provides Jest-compatible mocking with `mock()`, `spyOn()`, and module mocking.\n\n## Mock Functions\n\n```typescript\nimport { test, expect, mock } from \"bun:test\";\n\n\u002F\u002F Create mock function\nconst fn = mock(() => \"original\");\n\ntest(\"mock function\", () => {\n  fn(\"arg1\", \"arg2\");\n\n  expect(fn).toHaveBeenCalled();\n  expect(fn).toHaveBeenCalledTimes(1);\n  expect(fn).toHaveBeenCalledWith(\"arg1\", \"arg2\");\n});\n```\n\n### jest.fn() Compatibility\n\n```typescript\nimport { test, expect, jest } from \"bun:test\";\n\nconst fn = jest.fn(() => \"value\");\n\ntest(\"jest.fn works\", () => {\n  const result = fn();\n  expect(result).toBe(\"value\");\n  expect(fn).toHaveBeenCalled();\n});\n```\n\n## Mock Return Values\n\n```typescript\nconst fn = mock();\n\n\u002F\u002F Return value once\nfn.mockReturnValueOnce(\"first\");\nfn.mockReturnValueOnce(\"second\");\n\n\u002F\u002F Permanent return value\nfn.mockReturnValue(\"default\");\n\n\u002F\u002F Promise returns\nfn.mockResolvedValue(\"resolved\");\nfn.mockResolvedValueOnce(\"once\");\nfn.mockRejectedValue(new Error(\"fail\"));\nfn.mockRejectedValueOnce(new Error(\"once\"));\n```\n\n## Mock Implementations\n\n```typescript\nconst fn = mock();\n\n\u002F\u002F Set implementation\nfn.mockImplementation((x) => x * 2);\n\n\u002F\u002F One-time implementation\nfn.mockImplementationOnce((x) => x * 10);\n\n\u002F\u002F Chain implementations\nfn\n  .mockImplementationOnce(() => \"first\")\n  .mockImplementationOnce(() => \"second\")\n  .mockImplementation(() => \"default\");\n```\n\n## Spy on Methods\n\n```typescript\nimport { test, expect, spyOn } from \"bun:test\";\n\nconst obj = {\n  method: () => \"original\",\n};\n\ntest(\"spy on method\", () => {\n  const spy = spyOn(obj, \"method\");\n\n  obj.method();\n\n  expect(spy).toHaveBeenCalled();\n  expect(obj.method()).toBe(\"original\"); \u002F\u002F Still works\n\n  \u002F\u002F Override implementation\n  spy.mockImplementation(() => \"mocked\");\n  expect(obj.method()).toBe(\"mocked\");\n\n  \u002F\u002F Restore\n  spy.mockRestore();\n  expect(obj.method()).toBe(\"original\");\n});\n```\n\n## Mock Modules\n\n```typescript\nimport { test, expect, mock } from \"bun:test\";\n\n\u002F\u002F Mock entire module\nmock.module(\".\u002Futils\", () => ({\n  add: mock(() => 999),\n  subtract: mock(() => 0),\n}));\n\n\u002F\u002F Now imports use mocked version\nimport { add } from \".\u002Futils\";\n\ntest(\"mocked module\", () => {\n  expect(add(1, 2)).toBe(999);\n});\n```\n\n### Mock Node Modules\n\n```typescript\nmock.module(\"axios\", () => ({\n  default: {\n    get: mock(() => Promise.resolve({ data: \"mocked\" })),\n    post: mock(() => Promise.resolve({ data: \"created\" })),\n  },\n}));\n```\n\n### Mock with Factory\n\n```typescript\nmock.module(\".\u002Fconfig\", () => {\n  return {\n    API_URL: \"http:\u002F\u002Ftest.local\",\n    DEBUG: true,\n  };\n});\n```\n\n## Mock Assertions\n\n```typescript\nconst fn = mock();\n\nfn(\"a\", \"b\");\nfn(\"c\", \"d\");\n\n\u002F\u002F Call count\nexpect(fn).toHaveBeenCalled();\nexpect(fn).toHaveBeenCalledTimes(2);\n\n\u002F\u002F Call arguments\nexpect(fn).toHaveBeenCalledWith(\"a\", \"b\");\nexpect(fn).toHaveBeenLastCalledWith(\"c\", \"d\");\nexpect(fn).toHaveBeenNthCalledWith(1, \"a\", \"b\");\n\n\u002F\u002F Return values\nfn.mockReturnValue(\"result\");\nfn();\nexpect(fn).toHaveReturned();\nexpect(fn).toHaveReturnedWith(\"result\");\nexpect(fn).toHaveReturnedTimes(1);\n```\n\n## Mock Properties\n\n```typescript\nconst fn = mock(() => \"value\");\n\nfn(\"arg1\");\nfn(\"arg2\");\n\n\u002F\u002F Access call info\nfn.mock.calls;        \u002F\u002F [[\"arg1\"], [\"arg2\"]]\nfn.mock.results;      \u002F\u002F [{ type: \"return\", value: \"value\" }, ...]\nfn.mock.lastCall;     \u002F\u002F [\"arg2\"]\n\n\u002F\u002F Clear history\nfn.mockClear();       \u002F\u002F Clear calls, keep implementation\nfn.mockReset();       \u002F\u002F Clear calls + implementation\nfn.mockRestore();     \u002F\u002F Restore original (for spies)\n```\n\n## Common Patterns\n\n### Mock Fetch\n\n```typescript\nimport { test, expect, spyOn } from \"bun:test\";\n\ntest(\"mock fetch\", async () => {\n  const spy = spyOn(global, \"fetch\").mockResolvedValue(\n    new Response(JSON.stringify({ data: \"mocked\" }))\n  );\n\n  const response = await fetch(\"\u002Fapi\u002Fdata\");\n  const json = await response.json();\n\n  expect(json.data).toBe(\"mocked\");\n  expect(spy).toHaveBeenCalledWith(\"\u002Fapi\u002Fdata\");\n\n  spy.mockRestore();\n});\n```\n\n### Mock Console\n\n```typescript\ntest(\"mock console\", () => {\n  const spy = spyOn(console, \"log\");\n\n  console.log(\"test message\");\n\n  expect(spy).toHaveBeenCalledWith(\"test message\");\n  spy.mockRestore();\n});\n```\n\n### Mock Class Methods\n\n```typescript\nclass UserService {\n  async getUser(id: string) {\n    \u002F\u002F Real implementation\n  }\n}\n\ntest(\"mock class method\", () => {\n  const service = new UserService();\n  const spy = spyOn(service, \"getUser\").mockResolvedValue({\n    id: \"1\",\n    name: \"Test User\",\n  });\n\n  const user = await service.getUser(\"1\");\n\n  expect(user.name).toBe(\"Test User\");\n  expect(spy).toHaveBeenCalledWith(\"1\");\n});\n```\n\n## Common Errors\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| `Cannot spy on undefined` | Property doesn't exist | Check property name |\n| `Not a function` | Trying to mock non-function | Use correct mock approach |\n| `Already mocked` | Double mocking | Use mockRestore first |\n| `Module not found` | Wrong module path | Check path in mock.module |\n\n## When to Load References\n\nLoad `references\u002Fmock-api.md` when:\n- Complete mock\u002Fspy API reference\n- Advanced mocking patterns\n\nLoad `references\u002Fmodule-mocking.md` when:\n- Complex module mocking\n- Hoisting behavior details\n","# Bun Test Mocking\n\nBun provides Jest-compatible mocking with `mock()`, `spyOn()`, and module mocking.\n\n## Mock Functions\n\n```typescript\nimport { test, expect, mock } from \"bun:test\";\n\n\u002F\u002F Create mock function\nconst fn = mock(() => \"original\");\n\ntest(\"mock function\", () => {\n  fn(\"arg1\", \"arg2\");\n\n  expect(fn).toHaveBeenCalled();\n  expect(fn).toHaveBeenCalledTimes(1);\n  expect(fn).toHaveBeenCalledWith(\"arg1\", \"arg2\");\n});\n```\n\n### jest.fn() Compatibility\n\n```typescript\nimport { test, expect, jest } from \"bun:test\";\n\nconst fn = jest.fn(() => \"value\");\n\ntest(\"jest.fn works\", () => {\n  const result = fn();\n  expect(result).toBe(\"value\");\n  expect(fn).toHaveBeenCalled();\n});\n```\n\n## Mock Return Values\n\n```typescript\nconst fn = mock();\n\n\u002F\u002F Return value once\nfn.mockReturnValueOnce(\"first\");\nfn.mockReturnValueOnce(\"second\");\n\n\u002F\u002F Permanent return value\nfn.mockReturnValue(\"default\");\n\n\u002F\u002F Promise returns\nfn.mockResolvedValue(\"resolved\");\nfn.mockResolvedValueOnce(\"once\");\nfn.mockRejectedValue(new Error(\"fail\"));\nfn.mockRejectedValueOnce(new Error(\"once\"));\n```\n\n## Mock Implementations\n\n```typescript\nconst fn = mock();\n\n\u002F\u002F Set implementation\nfn.mockImplementation((x) => x * 2);\n\n\u002F\u002F One-time implementation\nfn.mockImplementationOnce((x) => x * 10);\n\n\u002F\u002F Chain implementations\nfn\n  .mockImplementationOnce(() => \"first\")\n  .mockImplementationOnce(() => \"second\")\n  .mockImplementation(() => \"default\");\n```\n\n## Spy on Methods\n\n```typescript\nimport { test, expect, spyOn } from \"bun:test\";\n\nconst obj = {\n  method: () => \"original\",\n};\n\ntest(\"spy on method\", () => {\n  const spy = spyOn(obj, \"method\");\n\n  obj.method();\n\n  expect(spy).toHaveBeenCalled();\n  expect(obj.method()).toBe(\"original\"); \u002F\u002F Still works\n\n  \u002F\u002F Override implementation\n  spy.mockImplementation(() => \"mocked\");\n  expect(obj.method()).toBe(\"mocked\");\n\n  \u002F\u002F Restore\n  spy.mockRestore();\n  expect(obj.method()).toBe(\"original\");\n});\n```\n\n## Mock Modules\n\n```typescript\nimport { test, expect, mock } from \"bun:test\";\n\n\u002F\u002F Mock entire module\nmock.module(\".\u002Futils\", () => ({\n  add: mock(() => 999),\n  subtract: mock(() => 0),\n}));\n\n\u002F\u002F Now imports use mocked version\nimport { add } from \".\u002Futils\";\n\ntest(\"mocked module\", () => {\n  expect(add(1, 2)).toBe(999);\n});\n```\n\n### Mock Node Modules\n\n```typescript\nmock.module(\"axios\", () => ({\n  default: {\n    get: mock(() => Promise.resolve({ data: \"mocked\" })),\n    post: mock(() => Promise.resolve({ data: \"created\" })),\n  },\n}));\n```\n\n### Mock with Factory\n\n```typescript\nmock.module(\".\u002Fconfig\", () => {\n  return {\n    API_URL: \"http:\u002F\u002Ftest.local\",\n    DEBUG: true,\n  };\n});\n```\n\n## Mock Assertions\n\n```typescript\nconst fn = mock();\n\nfn(\"a\", \"b\");\nfn(\"c\", \"d\");\n\n\u002F\u002F Call count\nexpect(fn).toHaveBeenCalled();\nexpect(fn).toHaveBeenCalledTimes(2);\n\n\u002F\u002F Call arguments\nexpect(fn).toHaveBeenCalledWith(\"a\", \"b\");\nexpect(fn).toHaveBeenLastCalledWith(\"c\", \"d\");\nexpect(fn).toHaveBeenNthCalledWith(1, \"a\", \"b\");\n\n\u002F\u002F Return values\nfn.mockReturnValue(\"result\");\nfn();\nexpect(fn).toHaveReturned();\nexpect(fn).toHaveReturnedWith(\"result\");\nexpect(fn).toHaveReturnedTimes(1);\n```\n\n## Mock Properties\n\n```typescript\nconst fn = mock(() => \"value\");\n\nfn(\"arg1\");\nfn(\"arg2\");\n\n\u002F\u002F Access call info\nfn.mock.calls;        \u002F\u002F [[\"arg1\"], [\"arg2\"]]\nfn.mock.results;      \u002F\u002F [{ type: \"return\", value: \"value\" }, ...]\nfn.mock.lastCall;     \u002F\u002F [\"arg2\"]\n\n\u002F\u002F Clear history\nfn.mockClear();       \u002F\u002F Clear calls, keep implementation\nfn.mockReset();       \u002F\u002F Clear calls + implementation\nfn.mockRestore();     \u002F\u002F Restore original (for spies)\n```\n\n## Common Patterns\n\n### Mock Fetch\n\n```typescript\nimport { test, expect, spyOn } from \"bun:test\";\n\ntest(\"mock fetch\", async () => {\n  const spy = spyOn(global, \"fetch\").mockResolvedValue(\n    new Response(JSON.stringify({ data: \"mocked\" }))\n  );\n\n  const response = await fetch(\"\u002Fapi\u002Fdata\");\n  const json = await response.json();\n\n  expect(json.data).toBe(\"mocked\");\n  expect(spy).toHaveBeenCalledWith(\"\u002Fapi\u002Fdata\");\n\n  spy.mockRestore();\n});\n```\n\n### Mock Console\n\n```typescript\ntest(\"mock console\", () => {\n  const spy = spyOn(console, \"log\");\n\n  console.log(\"test message\");\n\n  expect(spy).toHaveBeenCalledWith(\"test message\");\n  spy.mockRestore();\n});\n```\n\n### Mock Class Methods\n\n```typescript\nclass UserService {\n  async getUser(id: string) {\n    \u002F\u002F Real implementation\n  }\n}\n\ntest(\"mock class method\", () => {\n  const service = new UserService();\n  const spy = spyOn(service, \"getUser\").mockResolvedValue({\n    id: \"1\",\n    name: \"Test User\",\n  });\n\n  const user = await service.getUser(\"1\");\n\n  expect(user.name).toBe(\"Test User\");\n  expect(spy).toHaveBeenCalledWith(\"1\");\n});\n```\n\n## Common Errors\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| `Cannot spy on undefined` | Property doesn't exist | Check property name |\n| `Not a function` | Trying to mock non-function | Use correct mock approach |\n| `Already mocked` | Double mocking | Use mockRestore first |\n| `Module not found` | Wrong module path | Check path in mock.module |\n\n## When to Load References\n\nLoad `references\u002Fmock-api.md` when:\n- Complete mock\u002Fspy API reference\n- Advanced mocking patterns\n\nLoad `references\u002Fmodule-mocking.md` when:\n- Complex module mocking\n- Hoisting behavior details\n",{"name":5,"license":15,"metadata":24,"description":7},{"version":25},"1.0.0","main","c475fc64e94e803b50d14a791dfee8853fbb2c5c","integrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fbun\u002Fskills\u002Fbun-test-mocking","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory","https:\u002F\u002Fgithub.com\u002FElogic360","2026-11-08 22:21:22",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add Elogic360\u002Fsoftware-factory --skill bun-test-mocking",{"tool":38,"command":39},"bunx","bunx skills add Elogic360\u002Fsoftware-factory --skill bun-test-mocking",{"tool":41,"command":42},"pnpm","pnpm dlx skills add Elogic360\u002Fsoftware-factory --skill bun-test-mocking","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fintegrations\u002Fclaude-skills-secondsky\u002Fplugins\u002Fbun\u002Fskills\u002Fbun-test-mocking\u002FSKILL.md",true,[],[47,55,62,69,76,83],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M79G206MT3J6S0GY3C45P2KV","vss-summarize-video","Use to summarize a recorded video via the LVS summarization microservice (HITL-gated) with a VLM fallback. Not for report generation or live RTSP captioning.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-summarize-video\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M79G1WN63PGRE8CKD47WEBQ5","vss-setup-video-analytics-api","Use to deploy the vss-video-analytics-api REST service standalone (config-source, data-log bind, Elasticsearch, optional Kafka). Not for full warehouse deploy.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-setup-video-analytics-api\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M79G1S9F7VY3EF6H53PRP5AN","vss-setup-behavior-analytics","Use to deploy the vss-behavior-analytics service standalone (entrypoint, config-source, optional calibration). Not for the full warehouse deploy.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-setup-behavior-analytics\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M79G1N1S1Y27PFZPYMNK1MTQ","vss-search-archive","Use this skill to run top-level VSS fusion search on archived video, or to ingest video files \u002F RTSP streams for search. Do NOT use for ad-hoc visual Q&A (use vss-ask-video), live captioning (use vss-deploy-dense-captioning), or video summarization and reports (use vss-summarize-video).","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-search-archive\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M79G1H6WN0Q6C0VCAXCZX6B7","vss-query-analytics","Use this skill when reading video-analytics metrics, incidents, alerts, and sensor data via the VA-MCP server (port 9901). Not for live VLM or incident-range narrative reports.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-query-analytics\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":51,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M79G1DYPNXQS7QHZ0AAF5FX5","vss-manage-video-io-storage","Use to call the VIOS REST API (sensor list, timelines, clip extraction, snapshots, add\u002Fdelete sensors and streams). Not for VLM inference or search.","https:\u002F\u002Fgithub.com\u002FElogic360\u002Fsoftware-factory\u002Fblob\u002Fmain\u002Fskills\u002Fnvidia\u002Fvss-manage-video-io-storage\u002FSKILL.md",[],[]]