Skip to content

Commit

Permalink
Fix test regressions
Browse files Browse the repository at this point in the history
  • Loading branch information
peterMuriuki committed Jan 27, 2025
1 parent 6ade1ec commit fb6b716
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { flag } from '../../Utils/tests/fixtures';
import { QueryClient, QueryClientProvider } from 'react-query';
import userEvents from '@testing-library/user-event';
import { status } from '../../../constants';
import { ContextProvider } from '@opensrp/react-utils';

jest.mock('@opensrp/notifications', () => ({
__esModule: true,
Expand Down Expand Up @@ -46,7 +47,9 @@ describe('CloseFlagForm component', () => {

render(
<QueryClientProvider client={queryClient}>
<CloseFlagForm {...props} />
<ContextProvider>
<CloseFlagForm {...props} />
</ContextProvider>
</QueryClientProvider>
);

Expand Down Expand Up @@ -83,7 +86,9 @@ describe('CloseFlagForm component', () => {

render(
<QueryClientProvider client={queryClient}>
<CloseFlagForm {...props} />
<ContextProvider>
<CloseFlagForm {...props} />
</ContextProvider>
</QueryClientProvider>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import {
import userEvents from '@testing-library/user-event';
import { status } from '../../../constants';
import * as notifications from '@opensrp/notifications';
import { RoleContext } from '@opensrp/rbac';
import { superUserRole } from '@opensrp/react-utils';

jest.mock('@opensrp/notifications', () => ({
__esModule: true,
Expand Down Expand Up @@ -122,9 +124,11 @@ test('renders correctly and fetches data', async () => {

render(
<QueryClientProvider client={queryClient}>
<Router history={history}>
<LocationFlag {...defaultProps} />
</Router>
<RoleContext.Provider value={superUserRole}>
<Router history={history}>
<LocationFlag {...defaultProps} />
</Router>
</RoleContext.Provider>
</QueryClientProvider>
);

Expand Down

0 comments on commit fb6b716

Please sign in to comment.