Skip to content

Commit

Permalink
Add tests for ScheduleDayFilterRow component
Browse files Browse the repository at this point in the history
  • Loading branch information
nina-py committed Jun 18, 2024
1 parent 0fb8399 commit 4a853a7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import { ThemeProvider } from '@mui/material/styles';
import theme from '../../../theme';
import { ScheduleDayFilterRow } from '..';

import { scheduledItems } from '../../integration-test-mocks/getScheduledItems';

describe('The ScheduleDayFilterRow component', () => {
it('should render the component', () => {
render(
<MemoryRouter>
<ThemeProvider theme={theme}>
<ScheduleDayFilterRow
scheduledItems={scheduledItems}
setFilters={jest.fn()}
/>
</ThemeProvider>
</MemoryRouter>,
);

// Make sure all three filters are present on the page
expect(screen.getByText(/Topics/i)).toBeInTheDocument();
expect(screen.getByText(/Types/i)).toBeInTheDocument();
expect(screen.getByText(/Publishers/i)).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface ScheduleDayFilterOptions {
types: string;
}

interface SchedulePageFilterRowProps {
interface ScheduleDayFilterRowProps {
/**
* Scheduled items for a given date - to summarise in the filters
*/
Expand All @@ -35,7 +35,7 @@ interface SchedulePageFilterRowProps {
* @param props
* @constructor
*/
export const ScheduleDayFilterRow: React.FC<SchedulePageFilterRowProps> = (
export const ScheduleDayFilterRow: React.FC<ScheduleDayFilterRowProps> = (
props,
): ReactElement => {
const { scheduledItems, setFilters } = props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ const approvedItem: ApprovedCorpusItem = {
externalId: '123-abc',
prospectId: '123-xyz',
title: 'How To Win Friends And Influence People with React',
url: 'http://www.test.com/how-to',
url: 'httpS://www.test.com/how-to',
hasTrustedDomain: true,
imageUrl: 'https://placeimg.com/640/480/people?random=494',
excerpt: 'Everything You Wanted to Know About React and Were Afraid To Ask',
language: CorpusLanguage.De,
Expand Down

0 comments on commit 4a853a7

Please sign in to comment.