From 7b084e96a6148d19a2375471599cbb4b2ba21a50 Mon Sep 17 00:00:00 2001 From: Patel Divyesh Date: Wed, 6 Dec 2023 22:51:55 +0530 Subject: [PATCH] Added test for src/components/OrganizationDashCards/CardItem.tsx (#1139) --- .../OrganizationDashCards/CardItem.test.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/OrganizationDashCards/CardItem.test.tsx b/src/components/OrganizationDashCards/CardItem.test.tsx index 2102e86f94..3bfee8aa1c 100644 --- a/src/components/OrganizationDashCards/CardItem.test.tsx +++ b/src/components/OrganizationDashCards/CardItem.test.tsx @@ -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(); @@ -18,6 +19,7 @@ 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', () => { @@ -25,6 +27,13 @@ describe('Testing the Organization Card', () => { type: 'Post', title: 'Post Title', time: '2023-09-03', + creator: { + email: 'johndoe@example.com', + firstName: 'John', + lastName: 'Doe', + __typename: 'User', + _id: '1', + }, }; render(); @@ -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', () => {