From f38b863773a9a10b64d1308412329bb8a61f6f95 Mon Sep 17 00:00:00 2001 From: skbhagat0502 Date: Tue, 7 Nov 2023 18:24:19 +0530 Subject: [PATCH] add test complete --- .../LeftDrawerEvent/LeftDrawerEvent.test.tsx | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx b/src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx index ea4b1a5cdb..0fabcd2c55 100644 --- a/src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx +++ b/src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx @@ -25,6 +25,20 @@ const props: InterfaceLeftDrawerProps = { setHideDrawer: jest.fn(), setShowAddEventProjectModal: jest.fn(), }; +const props2: InterfaceLeftDrawerProps = { + event: { + _id: 'testEvent', + title: 'This is a very long event title that exceeds 20 characters', + description: + 'This is a very long event description that exceeds 30 characters. It contains more details about the event.', + organization: { + _id: 'Test Organization', + }, + }, + hideDrawer: false, + setHideDrawer: jest.fn(), + setShowAddEventProjectModal: jest.fn(), +}; const mocks = [ { @@ -190,17 +204,18 @@ describe('Testing Left Drawer component for the Event Dashboard', () => { - + ); - const eventTitle = 'This is a long event title that will be truncated'; + const eventTitle = props2.event.title; + expect(eventTitle.length).toBeGreaterThan(20); + const eventDescription = props2.event.description; + expect(eventDescription.length).toBeGreaterThan(30); const truncatedEventTitle = eventTitle.substring(0, 20) + '...'; - expect(truncatedEventTitle).toContain('...'); - const eventDescription = - 'This is a long event description that will be truncated'; const truncatedEventDescription = eventDescription.substring(0, 30) + '...'; + expect(truncatedEventTitle).toContain('...'); expect(truncatedEventDescription).toContain('...'); }); });