Skip to content

Commit

Permalink
Added test for src/components/OrganizationDashCards/CardItem.tsx (#1139)
Browse files Browse the repository at this point in the history
pateldivyesh1323 authored Dec 6, 2023
1 parent 2c972fd commit 7b084e9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/OrganizationDashCards/CardItem.test.tsx
Original file line number Diff line number Diff line change
@@ -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} />);
@@ -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} />);
@@ -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', () => {

0 comments on commit 7b084e9

Please sign in to comment.