Skip to content

Commit eabaccc

Browse files
committed
#1650 - add context
1 parent 395ded4 commit eabaccc

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

src/frontend/src/pages/ChangeRequestDetailPage/ProposedSolutionsList.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { useState } from 'react';
99
import { useCreateProposeSolution } from '../../hooks/change-requests.hooks';
1010
import ErrorPage from '../ErrorPage';
1111
import LoadingIndicator from '../../components/LoadingIndicator';
12-
import { useAuth } from '../../hooks/auth.hooks';
1312
import { Box, Button, Chip, Grid, Typography, useTheme } from '@mui/material';
1413
import { useToast } from '../../hooks/toasts.hooks';
1514
import DetailDisplay from '../../components/DetailDisplay';

src/frontend/src/tests/pages/ChangeRequestDetailPage/ProposedSolutionsList.test.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import { render, routerWrapperBuilder, screen } from '../../test-support/test-ut
77
import ProposedSolutionsList from '../../../pages/ChangeRequestDetailPage/ProposedSolutionsList';
88
import { ProposedSolution } from 'shared';
99
import { exampleAdminUser, exampleLeadershipUser } from '../../test-support/test-data/users.stub';
10-
import * as authHooks from '../../../hooks/auth.hooks';
11-
import { mockAuth } from '../../test-support/test-data/test-utils.stub';
1210
import { ToastProvider } from '../../../components/Toast/ToastProvider';
11+
import AppContextUser from '../../../app/AppContextUser';
12+
import * as userHooks from '../../../hooks/users.hooks';
1313

1414
const exampleProposedSolution1: ProposedSolution = {
1515
id: '1',
@@ -41,17 +41,19 @@ const exampleProposedSolutions = [exampleProposedSolution1, exampleProposedSolut
4141
const renderComponent = (proposedSolutions: ProposedSolution[] = [], crReviewed: boolean | undefined = undefined) => {
4242
const RouterWrapper = routerWrapperBuilder({});
4343
return render(
44-
<RouterWrapper>
45-
<ToastProvider>
46-
<ProposedSolutionsList proposedSolutions={proposedSolutions} crReviewed={crReviewed} crId={0} />{' '}
47-
</ToastProvider>
48-
</RouterWrapper>
44+
<AppContextUser>
45+
<RouterWrapper>
46+
<ToastProvider>
47+
<ProposedSolutionsList proposedSolutions={proposedSolutions} crReviewed={crReviewed} crId={0} />{' '}
48+
</ToastProvider>
49+
</RouterWrapper>
50+
</AppContextUser>
4951
);
5052
};
5153

5254
describe('Proposed Solutions List Test Suite', () => {
5355
beforeEach(() => {
54-
vi.spyOn(authHooks, 'useAuth').mockReturnValue(mockAuth(false, exampleAdminUser));
56+
vi.spyOn(userHooks, 'useCurrentUser').mockReturnValue(exampleAdminUser);
5557
});
5658

5759
it('Renders correctly when not empty and CR is not reviewed', () => {

0 commit comments

Comments
 (0)