Add Auth Index page (#323)

This commit is contained in:
Charles Bochet
2023-06-18 00:18:13 +02:00
committed by GitHub
parent 49462c69a2
commit ffa8318e2e
9 changed files with 144 additions and 12 deletions

View File

@ -0,0 +1,27 @@
import { graphql, setupWorker } from 'msw';
import { mockedCompaniesData } from '~/testing/mock-data/companies';
import { mockedUsersData } from '~/testing/mock-data/users';
export function useMockData() {
const worker = setupWorker(...graphqlMocks);
worker.start({ quiet: true, onUnhandledRequest: 'bypass' });
}
const graphqlMocks = [
graphql.query('GetCompanies', (req, res, ctx) => {
return res(
ctx.data({
companies: mockedCompaniesData,
}),
);
}),
graphql.query('GetCurrentUser', (req, res, ctx) => {
return res(
ctx.data({
users: [mockedUsersData[0]],
}),
);
}),
];