Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewgdewar committed Nov 22, 2023
1 parent bdd847c commit 10abbca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ jest.mock('react-router-dom', () => ({
}),
}));

jest.mock('../../../../middleware/AppContext', () => ({
useAppContext: () => ({ rbac: { read: true, write: true } }),
}));

it('Render 1 item', () => {
(useGetPackagesQuery as jest.Mock).mockImplementation(() => ({
isLoading: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {render, waitFor} from '@testing-library/react';
import { render, waitFor } from '@testing-library/react';
import SnapshotListModal from './SnapshotListModal';
import {
ReactQueryTestWrapper,
Expand All @@ -13,7 +13,7 @@ jest.mock('../../../../Hooks/useRootPath', () => () => 'someUrl');
jest.mock('../../../../services/Content/ContentQueries', () => ({
useFetchContent: jest.fn(),
useGetSnapshotList: jest.fn(),
useGetRepoConfigFileQuery: () => ({ mutateAsync: jest.fn() })
useGetRepoConfigFileQuery: () => ({ mutateAsync: jest.fn() }),
}));

jest.mock('react-router-dom', () => ({
Expand All @@ -23,6 +23,10 @@ jest.mock('react-router-dom', () => ({
}),
}));

jest.mock('../../../../middleware/AppContext', () => ({
useAppContext: () => ({ rbac: { read: true, write: true } }),
}));

it('Render 1 item', async () => {
(useFetchContent as jest.Mock).mockImplementation(() => ({
data: [defaultContentItem],
Expand Down Expand Up @@ -80,5 +84,4 @@ it('Render 20 items', async () => {
expect(
queryByText((defaultSnapshotItem.content_counts['rpm.package'] as number)?.toString()),
).toBeInTheDocument();

});

0 comments on commit 10abbca

Please sign in to comment.