diff options
Diffstat (limited to 'tests/msw/handlers/topics')
| -rw-r--r-- | tests/msw/handlers/topics/topic.handler.ts | 9 | ||||
| -rw-r--r-- | tests/msw/handlers/topics/topics-count.handler.ts | 9 | ||||
| -rw-r--r-- | tests/msw/handlers/topics/topics-list.handler.ts | 9 | ||||
| -rw-r--r-- | tests/msw/handlers/topics/topics-slugs.handler.ts | 9 |
4 files changed, 20 insertions, 16 deletions
diff --git a/tests/msw/handlers/topics/topic.handler.ts b/tests/msw/handlers/topics/topic.handler.ts index 5df00ea..1cb565b 100644 --- a/tests/msw/handlers/topics/topic.handler.ts +++ b/tests/msw/handlers/topics/topic.handler.ts @@ -1,14 +1,15 @@ -import { type ExecutionResult, graphql as executeGraphql } from 'graphql'; -import { HttpResponse, graphql } from 'msw'; +import { type ExecutionResult, graphql } from 'graphql'; +import { HttpResponse } from 'msw'; import type { TopicResponse } from '../../../../src/services/graphql'; import { wpTopicsFixture } from '../../../fixtures'; +import { wordpressAPI } from '../../instances'; import { schema } from '../../schema'; -export const topicHandler = graphql.query< +export const topicHandler = wordpressAPI.query< TopicResponse, Record<'slug', string> >('Topic', async ({ query, variables }) => { - const { data, errors } = (await executeGraphql({ + const { data, errors } = (await graphql({ schema, source: query, variableValues: variables, diff --git a/tests/msw/handlers/topics/topics-count.handler.ts b/tests/msw/handlers/topics/topics-count.handler.ts index 7e3dab9..0a48d06 100644 --- a/tests/msw/handlers/topics/topics-count.handler.ts +++ b/tests/msw/handlers/topics/topics-count.handler.ts @@ -1,12 +1,13 @@ -import { type ExecutionResult, graphql as executeGraphql } from 'graphql'; -import { HttpResponse, graphql } from 'msw'; +import { type ExecutionResult, graphql } from 'graphql'; +import { HttpResponse } from 'msw'; import type { TopicsCountResponse } from '../../../../src/services/graphql'; import type { GraphQLPostWhere } from '../../../../src/types'; import { wpTopicsFixture } from '../../../fixtures'; import { getConnection } from '../../../utils/graphql'; +import { wordpressAPI } from '../../instances'; import { schema } from '../../schema'; -export const topicsCountHandler = graphql.query< +export const topicsCountHandler = wordpressAPI.query< TopicsCountResponse, GraphQLPostWhere >('TopicsCount', async ({ query, variables }) => { @@ -15,7 +16,7 @@ export const topicsCountHandler = graphql.query< if (isError) return HttpResponse.json({ data: { topics: null } }); - const { data, errors } = (await executeGraphql({ + const { data, errors } = (await graphql({ schema, source: query, variableValues: variables, diff --git a/tests/msw/handlers/topics/topics-list.handler.ts b/tests/msw/handlers/topics/topics-list.handler.ts index 4b09c5a..86a8dba 100644 --- a/tests/msw/handlers/topics/topics-list.handler.ts +++ b/tests/msw/handlers/topics/topics-list.handler.ts @@ -1,14 +1,15 @@ -import { type ExecutionResult, graphql as executeGraphql } from 'graphql'; -import { HttpResponse, graphql } from 'msw'; +import { type ExecutionResult, graphql } from 'graphql'; +import { HttpResponse } from 'msw'; import type { FetchTopicsListInput, TopicsListResponse, } from '../../../../src/services/graphql'; import { wpTopicsFixture } from '../../../fixtures'; import { getConnection } from '../../../utils/graphql'; +import { wordpressAPI } from '../../instances'; import { schema } from '../../schema'; -export const topicsListHandler = graphql.query< +export const topicsListHandler = wordpressAPI.query< TopicsListResponse, FetchTopicsListInput >('TopicsList', async ({ query, variables }) => { @@ -17,7 +18,7 @@ export const topicsListHandler = graphql.query< if (isError) return HttpResponse.json({ data: { topics: null } }); - const { data, errors } = (await executeGraphql({ + const { data, errors } = (await graphql({ schema, source: query, variableValues: variables, diff --git a/tests/msw/handlers/topics/topics-slugs.handler.ts b/tests/msw/handlers/topics/topics-slugs.handler.ts index 960e411..779a384 100644 --- a/tests/msw/handlers/topics/topics-slugs.handler.ts +++ b/tests/msw/handlers/topics/topics-slugs.handler.ts @@ -1,10 +1,11 @@ -import { type ExecutionResult, graphql as executeGraphql } from 'graphql'; -import { HttpResponse, graphql } from 'msw'; +import { type ExecutionResult, graphql } from 'graphql'; +import { HttpResponse } from 'msw'; import type { TopicsSlugsResponse } from '../../../../src/services/graphql'; import { wpTopicsFixture } from '../../../fixtures'; +import { wordpressAPI } from '../../instances'; import { schema } from '../../schema'; -export const topicsSlugsHandler = graphql.query< +export const topicsSlugsHandler = wordpressAPI.query< TopicsSlugsResponse, Record<'first', number> >('TopicsSlugs', async ({ query, variables }) => { @@ -13,7 +14,7 @@ export const topicsSlugsHandler = graphql.query< if (isError) return HttpResponse.json({ data: { topics: null } }); - const { data, errors } = (await executeGraphql({ + const { data, errors } = (await graphql({ schema, source: query, variableValues: variables, |
