Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Coverage: Updated test for src/components/OrganizationDashCards/CardItem.tsx #1139

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/components/OrganizationDashCards/CardItem.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import type { InterfaceCardItem } from './CardItem';
import dayjs from 'dayjs';

describe('Testing the Organization Card', () => {
test('should render props and text elements For event card', () => {
test('Should render props and text elements For event card', () => {
const props: InterfaceCardItem = {
type: 'Event',
title: 'Event Title',
time: '2023-09-03',
location: 'Event Location',
};

render(<CardItem {...props} />);
Expand All @@ -18,13 +19,21 @@ describe('Testing the Organization Card', () => {
expect(
screen.getByText(dayjs(props.time).format('MMM D, YYYY'))
).toBeInTheDocument();
expect(screen.getByText(/Event Location/i)).toBeInTheDocument();
});

test('Should render props and text elements for Post card', () => {
const props: InterfaceCardItem = {
type: 'Post',
title: 'Post Title',
time: '2023-09-03',
creator: {
email: '[email protected]',
firstName: 'John',
lastName: 'Doe',
__typename: 'User',
_id: '1',
},
};

render(<CardItem {...props} />);
Expand All @@ -33,6 +42,7 @@ describe('Testing the Organization Card', () => {
expect(
screen.getByText(dayjs(props.time).format('MMM D, YYYY'))
).toBeInTheDocument();
expect(screen.getByText(/John Doe/i)).toBeInTheDocument();
});

test('Should render props and text elements for Membership Request card', () => {
Expand Down