From b8eb008dd5927fb736e56699637f5f8549965eae Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 6 Dec 2023 18:20:54 +0100 Subject: 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 --- tests/msw/instances/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/msw/instances/index.ts (limited to 'tests/msw/instances/index.ts') 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); -- cgit v1.2.3