Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric committed Dec 10, 2024
1 parent d8d21d6 commit 2a17a15
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ test('renders a list of dashboard menu items', () => {
const { getAllByRole } = render(
<Provider store={mockStore}>
<Router history={createMemoryHistory()}>
<NavigationMenu />
<NavigationMenu close={() => {}} />
</Router>
</Provider>
)
Expand All @@ -62,7 +62,7 @@ test('renders a notification if no dashboards are available', () => {
const { getByText } = render(
<Provider store={mockStore}>
<Router history={createMemoryHistory()}>
<NavigationMenu />
<NavigationMenu close={() => {}} />
</Router>
</Provider>
)
Expand All @@ -79,7 +79,7 @@ test('renders a placeholder list item if no dashboards meet the filter criteria'
const { getByText, getByPlaceholderText } = render(
<Provider store={mockStore}>
<Router history={createMemoryHistory()}>
<NavigationMenu />
<NavigationMenu close={() => {}} />
</Router>
</Provider>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const defaultProps = {
starred: false,
displayName: 'Rainbow Dash',
id: 'rainbowdash',
close: Function.prototype,
}

const selectedId = 'theselectedid'
Expand Down
7 changes: 6 additions & 1 deletion src/pages/view/FilterBar/__tests__/FilterBadge.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import FilterBadge from '../FilterBadge.js'
jest.mock('@dhis2/app-runtime', () => ({
useDhis2ConnectionStatus: jest.fn(() => ({ isConnected: true })),
}))
jest.mock('../../../../components/WindowDimensionsProvider.js', () => ({
useWindowDimensions: () => ({
width: 1920,
height: 1080,
}),
}))

const baseState = { selected: { id: 'dashboard1' } }
const createMockStore = (state) =>
Expand Down Expand Up @@ -74,7 +80,6 @@ test('Has enabled buttons when online', () => {
expect(getByTestId('filter-badge-button')).toBeEnabled()
expect(getByTestId('filter-badge-clear-button')).toBeEnabled()
})

test('Has disabled buttons when offline', () => {
useDhis2ConnectionStatus.mockImplementation(() => ({ isConnected: false }))
const filter = {
Expand Down

0 comments on commit 2a17a15

Please sign in to comment.