Skip to content

Commit

Permalink
add test complete
Browse files Browse the repository at this point in the history
  • Loading branch information
skbhagat0502 committed Nov 7, 2023
1 parent 9bf8cb0 commit f38b863
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
{
Expand Down Expand Up @@ -190,17 +204,18 @@ describe('Testing Left Drawer component for the Event Dashboard', () => {
<MockedProvider mocks={mocks}>
<BrowserRouter>
<I18nextProvider i18n={i18nForTest}>
<LeftDrawerEvent {...props} />
<LeftDrawerEvent {...props2} />
</I18nextProvider>
</BrowserRouter>
</MockedProvider>
);
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('...');
});
});

0 comments on commit f38b863

Please sign in to comment.