Skip to content

Commit

Permalink
Organise mocks directory
Browse files Browse the repository at this point in the history
  • Loading branch information
demccormack committed Oct 13, 2023
1 parent 452c903 commit 9419313
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { setupServer } from 'msw/node';
import { rest } from 'msw';
import top from './top';
import Films from './Films';
import OfficeSpace from './OfficeSpace';

export const handlers = [
const handlers = [
rest.get(import.meta.env.VITE_API_ROOT, (req, res, ctx) => {
const dir = req.url.searchParams.get('dir');

Expand Down Expand Up @@ -34,3 +35,7 @@ export const handlers = [
return res(ctx.status(204));
}),
];

const server = setupServer(...handlers);

export { handlers, server };
4 changes: 0 additions & 4 deletions frontend/tests/mocks/server.ts

This file was deleted.

2 changes: 1 addition & 1 deletion frontend/vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'vitest';
import '@testing-library/jest-dom';
import matchers from '@testing-library/jest-dom/matchers';
import { server } from './tests/mocks/server';
import { server } from './tests/mocks';

// extends Vitest's expect method with methods from react-testing-library
expect.extend(matchers);
Expand Down

0 comments on commit 9419313

Please sign in to comment.