{"id":13809792,"url":"https://github.com/seamapi/nextjs-ava-fixture","last_synced_at":"2025-03-23T16:28:06.213Z","repository":{"id":40376243,"uuid":"423705702","full_name":"seamapi/nextjs-ava-fixture","owner":"seamapi","description":"NextJS AVA testing fixture. Test API routes and pages with AVA","archived":false,"fork":false,"pushed_at":"2024-12-17T18:46:08.000Z","size":430,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-19T09:42:56.917Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seamapi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-11-02T04:24:11.000Z","updated_at":"2022-01-08T22:03:03.000Z","dependencies_parsed_at":"2023-07-15T18:07:06.404Z","dependency_job_id":null,"html_url":"https://github.com/seamapi/nextjs-ava-fixture","commit_stats":null,"previous_names":["hello-seam/nextjs-ava-fixture"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fnextjs-ava-fixture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fnextjs-ava-fixture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fnextjs-ava-fixture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seamapi%2Fnextjs-ava-fixture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seamapi","download_url":"https://codeload.github.com/seamapi/nextjs-ava-fixture/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245130182,"owners_count":20565610,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T02:00:36.170Z","updated_at":"2025-03-23T16:28:06.174Z","avatar_url":"https://github.com/seamapi.png","language":"JavaScript","readme":"# NextJS Ava Fixture\n\nThis package sets up a testing fixture for NextJS applications.\n\nIt's great for testing API endpoints.\n\nFor more speed, you might want to use [nextjs-server-modules](https://github.com/seamapi/nextjs-server-modules) which\nhave a faster compilation process.\n\n## Installation\n\n```sh\nnpm install --save nextjs-ava-fixture\n```\n\n## Usage\n\n```ts\nimport test from \"ava\"\nimport fixture from \"nextjs-ava-fixture\"\n\ntest(\"api endpoint\", async (t) =\u003e {\n  const { serverURL, axios } = await fixture(t)\n  // axios is automatically configured with the base URL of the test server\n  const { data: res } = await axios.get(\"/api/hello\")\n  t.deepEqual(res, { name: \"John Doe\" })\n})\n```\n\n### Usage with Middleware\n\n```ts\n// get-test-server.ts\nimport { createDb } from \"lib/db\"\nimport getFixture from \"nextjs-ava-fixture\"\n\nexport default async (t) =\u003e {\n  const db = await createDb()\n\n  const sharedDbMw = (next) =\u003e (req, res) =\u003e {\n    req.db = db\n    return next(req, res)\n  }\n\n  const fixture = await getFixture(t, {\n    middlewares: [sharedDbMw],\n  })\n\n  return {\n    ...fixture,\n    db,\n  }\n}\n```\n","funding_links":[],"categories":["Official Projects"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseamapi%2Fnextjs-ava-fixture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseamapi%2Fnextjs-ava-fixture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseamapi%2Fnextjs-ava-fixture/lists"}