Tag: react-query
-
Unexpected error object with mock-service-worker and react-query with graphql
0 I’m writing a test where I expect an error message to show. This is the component I’m testing: export const CourseOverview = () => { const { data, isError, error, isSuccess } = useGetCourses(); if (isError) { return <div>{error.message}</div>; } if (isSuccess) { return ( <CourseAccordion items={data.courses} /> ); } return <div>Loading…</div>; }; useGetCourses…
-
Access multiple nested TypeScript type generated from GraphQL
0 I need to access only the "departments" type in this large type generated from GraphQL: export type GetCompanyChartQuery = ( { __typename?: ‘Query’ } & { generateOrgChart?: Maybe<( { __typename?: ‘DepartmentNode’ } & Pick<DepartmentNode, ‘name’> & { manager?: Maybe<( { __typename?: ‘EmployeeNode’ } & Pick<EmployeeNode, ‘name’ | ‘mobilePhone’> )>, departments?: Maybe<Array<Maybe<( { __typename?: ‘DepartmentNode’…