Skip to content

Commit

Permalink
fix: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
samwel141 committed May 7, 2024
1 parent 267930e commit 21ffd8b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/layout/Layout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import { BrowserRouter as Router } from 'react-router-dom';
import { ThemeProvider } from '@mui/material';
import { render, screen } from '@testing-library/react';
import theme from '../UI/theme';
import apiClient from '../../utils/apiClient';
import { acceptTrustRelationship } from '../../api/trust_relationships';


jest.mock('../../utils/apiClient', () => ({
apiClient: jest.fn()
}));
jest.mock('../../api/trust_relationships', () => ({
acceptTrustRelationship : jest.fn(),
}));



Expand Down
3 changes: 3 additions & 0 deletions src/components/layout/Menu/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import * as React from 'react';
import MenuItem from './MenuItem/MenuItem';
import { DrawerHeaderStyled, DrawerStyled } from './MenuStyled';
import TopMenu from './TopMenu/TopMenu';
import { TrustRelationshipsProvider } from '../../../store/TrustRelationshipsContext';

const Menu = ({ open, handleDrawerClose, handleDrawerOpen }) => {
const theme = useTheme();
Expand All @@ -23,7 +24,9 @@ const Menu = ({ open, handleDrawerClose, handleDrawerOpen }) => {
)}
</IconButton>
</DrawerHeaderStyled>
<TrustRelationshipsProvider>
<MenuItem open={open} />
</TrustRelationshipsProvider>
</DrawerStyled>
</>
);
Expand Down
4 changes: 4 additions & 0 deletions src/components/layout/Menu/Menu.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ import theme from '../../UI/theme';
import { BrowserRouter as Router } from 'react-router-dom';
import { render, screen } from '@testing-library/react';
import apiClient from '../../../utils/apiClient';
import { acceptTrustRelationship } from '../../../api/trust_relationships';

jest.mock('../../../utils/apiClient', () => ({
apiClient: jest.fn(),
}));
jest.mock('../../../api/trust_relationships', () => ({
acceptTrustRelationship : jest.fn(),
}));

describe('Menu component', () => {
const TestWrapper = (props) => {
Expand Down
4 changes: 4 additions & 0 deletions src/components/layout/Menu/MenuItem/MenuItem.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import theme from '../../../UI/theme';
import { BrowserRouter as Router } from 'react-router-dom';
import apiClient from '../../../../utils/apiClient';
import { TrustRelationshipsProvider } from '../../../../store/TrustRelationshipsContext';
import { acceptTrustRelationship } from '../../../../api/trust_relationships';

jest.mock('../../../../utils/apiClient', () => ({
apiClient: jest.fn(),
}));
jest.mock('../../../../api/trust_relationships', () => ({
acceptTrustRelationship : jest.fn(),
}));

describe('MenuItem tests v1', () => {
const TestWrapper = (props) => {
Expand Down

0 comments on commit 21ffd8b

Please sign in to comment.