diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-12-06 18:20:54 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-12-07 19:12:11 +0100 |
| commit | b8eb008dd5927fb736e56699637f5f8549965eae (patch) | |
| tree | 648274babea3d3d09ed3e0f5f1fef013f94158fb /tests/msw/instances/index.ts | |
| parent | 802285872a2c57e7a5e130f32a2b45497d7687f1 (diff) | |
refactor(hooks): replace useGithubApi with useGithubRepoMeta
* use GraphQL API instead of REST (the inconvenient however is that we
now need an authorization token...)
* move fetcher in services
* add tests
* mock response using MSW
Diffstat (limited to 'tests/msw/instances/index.ts')
| -rw-r--r-- | tests/msw/instances/index.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/msw/instances/index.ts b/tests/msw/instances/index.ts new file mode 100644 index 0000000..82218c3 --- /dev/null +++ b/tests/msw/instances/index.ts @@ -0,0 +1,10 @@ +import { graphql } from 'msw'; +import { GITHUB_API } from '../../../src/utils/constants'; + +const wordpressGraphQLUrl = process.env.NEXT_PUBLIC_STAGING_GRAPHQL_API; + +if (!wordpressGraphQLUrl) + throw new Error('You forgot to define an URL for the WordPress GraphQL API'); + +export const githubAPI = graphql.link(GITHUB_API); +export const wordpressAPI = graphql.link(wordpressGraphQLUrl); |
