[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FG46ZJ0QSB3PHF7Z6D4SYR":3,"skill-same:01M6FG46ZJ0QSB3PHF7Z6D4SYR":68},{"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":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":50,"ownerHtmlUrl":51,"ownerBlogUrl":6,"ownerDescription":52,"updatedAt":53,"install":54,"resources":67},"01M6FG46ZJ0QSB3PHF7Z6D4SYR","api-testing",null,"HTTP API testing for TypeScript (Supertest) and Python (httpx, pytest). Test REST APIs, GraphQL, request\u002Fresponse validation, authentication, and error handling.","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fsecondsky\u002Fclaude-skills\u002Fapi-testing\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"testing","api testing","api","http api","error","httpx","edit","write","read","grep","Bash","GraphQL","REST","validation","authentication","error handling","http","test","python","typescript","2026-11-10 10:12:30",false,"---\nname: api-testing\ndescription: HTTP API testing for TypeScript (Supertest) and Python (httpx, pytest). Test REST APIs, GraphQL, request\u002Fresponse validation, authentication, and error handling.\nallowed-tools: Bash, Read, Edit, Write, Grep, Glob, TodoWrite\nlicense: MIT\n---\n\n# API Testing\n\nExpert knowledge for testing HTTP APIs with Supertest (TypeScript\u002FJavaScript) and httpx\u002Fpytest (Python).\n\n## TypeScript\u002FJavaScript (Supertest)\n\n### Installation\n\n```bash\n# Using Bun\nbun add -d supertest @types\u002Fsupertest\n\n# or: npm install -D supertest @types\u002Fsupertest\n```\n\n### Basic Setup\n\n```typescript\nimport { describe, it, expect } from 'vitest'\nimport request from 'supertest'\nimport { app } from '.\u002Fapp'\n\ndescribe('API Tests', () => {\n  it('returns health status', async () => {\n    const response = await request(app)\n      .get('\u002Fapi\u002Fhealth')\n      .expect(200)\n\n    expect(response.body).toEqual({ status: 'ok' })\n  })\n\n  it('creates a user', async () => {\n    const response = await request(app)\n      .post('\u002Fapi\u002Fusers')\n      .send({ name: 'John Doe', email: 'john@example.com' })\n      .expect(201)\n\n    expect(response.body).toMatchObject({\n      id: expect.any(Number),\n      name: 'John Doe',\n    })\n  })\n\n  it('validates required fields', async () => {\n    await request(app)\n      .post('\u002Fapi\u002Fusers')\n      .send({ name: 'John Doe' })\n      .expect(400)\n  })\n})\n```\n\n### Request Methods\n\n```typescript\n\u002F\u002F GET\nawait request(app).get('\u002Fapi\u002Fusers').expect(200)\n\n\u002F\u002F POST with body\nawait request(app)\n  .post('\u002Fapi\u002Fusers')\n  .send({ name: 'John' })\n  .expect(201)\n\n\u002F\u002F PUT\nawait request(app)\n  .put('\u002Fapi\u002Fusers\u002F1')\n  .send({ name: 'Jane' })\n  .expect(200)\n\n\u002F\u002F DELETE\nawait request(app).delete('\u002Fapi\u002Fusers\u002F1').expect(204)\n```\n\n### Headers and Query Parameters\n\n```typescript\n\u002F\u002F Set headers\nawait request(app)\n  .get('\u002Fapi\u002Fprotected')\n  .set('Authorization', 'Bearer token123')\n  .expect(200)\n\n\u002F\u002F Query parameters\nawait request(app)\n  .get('\u002Fapi\u002Fusers')\n  .query({ page: 1, limit: 10 })\n  .expect(200)\n```\n\n### Authentication Testing\n\n```typescript\ndescribe('Authentication', () => {\n  let authToken: string\n\n  beforeAll(async () => {\n    const response = await request(app)\n      .post('\u002Fapi\u002Fauth\u002Flogin')\n      .send({ email: 'user@example.com', password: 'password123' })\n      .expect(200)\n\n    authToken = response.body.token\n  })\n\n  it('accesses protected endpoint', async () => {\n    await request(app)\n      .get('\u002Fapi\u002Fprotected')\n      .set('Authorization', `Bearer ${authToken}`)\n      .expect(200)\n  })\n\n  it('rejects without token', async () => {\n    await request(app).get('\u002Fapi\u002Fprotected').expect(401)\n  })\n})\n```\n\n### Error Handling\n\n```typescript\nit('handles validation errors', async () => {\n  const response = await request(app)\n    .post('\u002Fapi\u002Fusers')\n    .send({ email: 'invalid-email' })\n    .expect(400)\n\n  expect(response.body).toMatchObject({\n    error: 'Validation failed',\n    details: expect.any(Array),\n  })\n})\n\nit('handles not found', async () => {\n  await request(app).get('\u002Fapi\u002Fusers\u002F999999').expect(404)\n})\n```\n\n## Python (httpx + pytest)\n\n### Installation\n\n```bash\nuv add --dev httpx pytest-asyncio\n```\n\n### Basic Setup\n\n```python\nimport pytest\nfrom fastapi.testclient import TestClient\nfrom main import app\n\nclient = TestClient(app)\n\ndef test_health_check():\n    response = client.get(\"\u002Fapi\u002Fhealth\")\n    assert response.status_code == 200\n    assert response.json() == {\"status\": \"ok\"}\n\ndef test_create_user():\n    response = client.post(\n        \"\u002Fapi\u002Fusers\",\n        json={\"name\": \"John Doe\", \"email\": \"john@example.com\"}\n    )\n    assert response.status_code == 201\n    data = response.json()\n    assert data[\"name\"] == \"John Doe\"\n    assert \"id\" in data\n\ndef test_not_found():\n    response = client.get(\"\u002Fapi\u002Fusers\u002F999\")\n    assert response.status_code == 404\n```\n\n### Fixtures\n\n```python\n@pytest.fixture\ndef auth_token(client):\n    response = client.post(\n        \"\u002Fapi\u002Fauth\u002Flogin\",\n        json={\"email\": \"user@example.com\", \"password\": \"password123\"}\n    )\n    return response.json()[\"token\"]\n\ndef test_protected_endpoint(client, auth_token):\n    response = client.get(\n        \"\u002Fapi\u002Fprotected\",\n        headers={\"Authorization\": f\"Bearer {auth_token}\"}\n    )\n    assert response.status_code == 200\n```\n\n### File Upload\n\n```python\ndef test_file_upload(client, tmp_path):\n    test_file = tmp_path \u002F \"test.txt\"\n    test_file.write_text(\"test content\")\n\n    with open(test_file, \"rb\") as f:\n        response = client.post(\n            \"\u002Fapi\u002Fupload\",\n            files={\"file\": (\"test.txt\", f, \"text\u002Fplain\")}\n        )\n\n    assert response.status_code == 200\n```\n\n## GraphQL Testing\n\n```typescript\nit('queries GraphQL endpoint', async () => {\n  const query = `\n    query GetUser($id: ID!) {\n      user(id: $id) { id name email }\n    }\n  `\n\n  const response = await request(app)\n    .post('\u002Fgraphql')\n    .send({ query, variables: { id: '1' } })\n    .expect(200)\n\n  expect(response.body.data.user).toMatchObject({\n    id: '1',\n    name: expect.any(String),\n  })\n})\n```\n\n## Performance Testing\n\n```typescript\nit('responds within acceptable time', async () => {\n  const start = Date.now()\n  await request(app).get('\u002Fapi\u002Fusers').expect(200)\n  const duration = Date.now() - start\n  expect(duration).toBeLessThan(100) \u002F\u002F 100ms threshold\n})\n```\n\n## Best Practices\n\n- Group related endpoints in `describe` blocks\n- Reset database between tests\n- Validate status codes first\n- Check response structure\n- Test error message format\n- Mock external services\n- Test both happy path and error cases\n\n## See Also\n\n- `vitest-testing` - Unit testing framework\n- `playwright-testing` - E2E API testing\n- `test-quality-analysis` - Test quality patterns\n","# API Testing\n\nExpert knowledge for testing HTTP APIs with Supertest (TypeScript\u002FJavaScript) and httpx\u002Fpytest (Python).\n\n## TypeScript\u002FJavaScript (Supertest)\n\n### Installation\n\n```bash\n# Using Bun\nbun add -d supertest @types\u002Fsupertest\n\n# or: npm install -D supertest @types\u002Fsupertest\n```\n\n### Basic Setup\n\n```typescript\nimport { describe, it, expect } from 'vitest'\nimport request from 'supertest'\nimport { app } from '.\u002Fapp'\n\ndescribe('API Tests', () => {\n  it('returns health status', async () => {\n    const response = await request(app)\n      .get('\u002Fapi\u002Fhealth')\n      .expect(200)\n\n    expect(response.body).toEqual({ status: 'ok' })\n  })\n\n  it('creates a user', async () => {\n    const response = await request(app)\n      .post('\u002Fapi\u002Fusers')\n      .send({ name: 'John Doe', email: 'john@example.com' })\n      .expect(201)\n\n    expect(response.body).toMatchObject({\n      id: expect.any(Number),\n      name: 'John Doe',\n    })\n  })\n\n  it('validates required fields', async () => {\n    await request(app)\n      .post('\u002Fapi\u002Fusers')\n      .send({ name: 'John Doe' })\n      .expect(400)\n  })\n})\n```\n\n### Request Methods\n\n```typescript\n\u002F\u002F GET\nawait request(app).get('\u002Fapi\u002Fusers').expect(200)\n\n\u002F\u002F POST with body\nawait request(app)\n  .post('\u002Fapi\u002Fusers')\n  .send({ name: 'John' })\n  .expect(201)\n\n\u002F\u002F PUT\nawait request(app)\n  .put('\u002Fapi\u002Fusers\u002F1')\n  .send({ name: 'Jane' })\n  .expect(200)\n\n\u002F\u002F DELETE\nawait request(app).delete('\u002Fapi\u002Fusers\u002F1').expect(204)\n```\n\n### Headers and Query Parameters\n\n```typescript\n\u002F\u002F Set headers\nawait request(app)\n  .get('\u002Fapi\u002Fprotected')\n  .set('Authorization', 'Bearer token123')\n  .expect(200)\n\n\u002F\u002F Query parameters\nawait request(app)\n  .get('\u002Fapi\u002Fusers')\n  .query({ page: 1, limit: 10 })\n  .expect(200)\n```\n\n### Authentication Testing\n\n```typescript\ndescribe('Authentication', () => {\n  let authToken: string\n\n  beforeAll(async () => {\n    const response = await request(app)\n      .post('\u002Fapi\u002Fauth\u002Flogin')\n      .send({ email: 'user@example.com', password: 'password123' })\n      .expect(200)\n\n    authToken = response.body.token\n  })\n\n  it('accesses protected endpoint', async () => {\n    await request(app)\n      .get('\u002Fapi\u002Fprotected')\n      .set('Authorization', `Bearer ${authToken}`)\n      .expect(200)\n  })\n\n  it('rejects without token', async () => {\n    await request(app).get('\u002Fapi\u002Fprotected').expect(401)\n  })\n})\n```\n\n### Error Handling\n\n```typescript\nit('handles validation errors', async () => {\n  const response = await request(app)\n    .post('\u002Fapi\u002Fusers')\n    .send({ email: 'invalid-email' })\n    .expect(400)\n\n  expect(response.body).toMatchObject({\n    error: 'Validation failed',\n    details: expect.any(Array),\n  })\n})\n\nit('handles not found', async () => {\n  await request(app).get('\u002Fapi\u002Fusers\u002F999999').expect(404)\n})\n```\n\n## Python (httpx + pytest)\n\n### Installation\n\n```bash\nuv add --dev httpx pytest-asyncio\n```\n\n### Basic Setup\n\n```python\nimport pytest\nfrom fastapi.testclient import TestClient\nfrom main import app\n\nclient = TestClient(app)\n\ndef test_health_check():\n    response = client.get(\"\u002Fapi\u002Fhealth\")\n    assert response.status_code == 200\n    assert response.json() == {\"status\": \"ok\"}\n\ndef test_create_user():\n    response = client.post(\n        \"\u002Fapi\u002Fusers\",\n        json={\"name\": \"John Doe\", \"email\": \"john@example.com\"}\n    )\n    assert response.status_code == 201\n    data = response.json()\n    assert data[\"name\"] == \"John Doe\"\n    assert \"id\" in data\n\ndef test_not_found():\n    response = client.get(\"\u002Fapi\u002Fusers\u002F999\")\n    assert response.status_code == 404\n```\n\n### Fixtures\n\n```python\n@pytest.fixture\ndef auth_token(client):\n    response = client.post(\n        \"\u002Fapi\u002Fauth\u002Flogin\",\n        json={\"email\": \"user@example.com\", \"password\": \"password123\"}\n    )\n    return response.json()[\"token\"]\n\ndef test_protected_endpoint(client, auth_token):\n    response = client.get(\n        \"\u002Fapi\u002Fprotected\",\n        headers={\"Authorization\": f\"Bearer {auth_token}\"}\n    )\n    assert response.status_code == 200\n```\n\n### File Upload\n\n```python\ndef test_file_upload(client, tmp_path):\n    test_file = tmp_path \u002F \"test.txt\"\n    test_file.write_text(\"test content\")\n\n    with open(test_file, \"rb\") as f:\n        response = client.post(\n            \"\u002Fapi\u002Fupload\",\n            files={\"file\": (\"test.txt\", f, \"text\u002Fplain\")}\n        )\n\n    assert response.status_code == 200\n```\n\n## GraphQL Testing\n\n```typescript\nit('queries GraphQL endpoint', async () => {\n  const query = `\n    query GetUser($id: ID!) {\n      user(id: $id) { id name email }\n    }\n  `\n\n  const response = await request(app)\n    .post('\u002Fgraphql')\n    .send({ query, variables: { id: '1' } })\n    .expect(200)\n\n  expect(response.body.data.user).toMatchObject({\n    id: '1',\n    name: expect.any(String),\n  })\n})\n```\n\n## Performance Testing\n\n```typescript\nit('responds within acceptable time', async () => {\n  const start = Date.now()\n  await request(app).get('\u002Fapi\u002Fusers').expect(200)\n  const duration = Date.now() - start\n  expect(duration).toBeLessThan(100) \u002F\u002F 100ms threshold\n})\n```\n\n## Best Practices\n\n- Group related endpoints in `describe` blocks\n- Reset database between tests\n- Validate status codes first\n- Check response structure\n- Test error message format\n- Mock external services\n- Test both happy path and error cases\n\n## See Also\n\n- `vitest-testing` - Unit testing framework\n- `playwright-testing` - E2E API testing\n- `test-quality-analysis` - Test quality patterns\n",{"name":5,"license":15,"description":7,"allowed-tools":44},"Bash, Read, Edit, Write, Grep, Glob, TodoWrite","main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fsecondsky\u002Fclaude-skills\u002Fapi-testing",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill api-testing",{"tool":60,"command":61},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill api-testing",{"tool":63,"command":64},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill api-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fsecondsky\u002Fclaude-skills\u002Fapi-testing\u002FSKILL.md",true,[],[69,78,87,96,102,108],{"skillNo":70,"name":71,"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":72,"categories":73,"keywords":74,"publishedAt":39},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[75,76,77],"model","model hierarchy","model hierarchy skill",{"skillNo":79,"name":80,"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":81,"categories":82,"keywords":83,"publishedAt":39},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[84,85,86],"MCP","zoom","zoom mcp",{"skillNo":88,"name":89,"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":90,"categories":91,"keywords":92,"publishedAt":39},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[93,94,95,85],"sdk","zoom apps sdk","apps",{"skillNo":97,"name":98,"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":99,"categories":100,"keywords":101,"publishedAt":39},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[98],{"skillNo":103,"name":104,"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":105,"categories":106,"keywords":107,"publishedAt":39},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[104],{"skillNo":109,"name":110,"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":111,"categories":112,"keywords":113,"publishedAt":39},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[110]]