Skip to content

Commit

Permalink
Merge branch 'userProfile' of https://github.com/skbhagat0502/talawa-…
Browse files Browse the repository at this point in the history
…admin into userProfile
  • Loading branch information
skbhagat0502 committed Nov 15, 2023
2 parents c116e9a + 1994b9c commit 11caf11
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 8 deletions.
19 changes: 18 additions & 1 deletion src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const props: InterfaceLeftDrawerProps = {
title: 'Test Event',
description: 'Test Description',
organization: {
_id: 'Test Organization',
_id: 'TestOrganization',
},
},
hideDrawer: false,
Expand Down Expand Up @@ -216,4 +216,21 @@ describe('Testing Left Drawer component for the Event Dashboard', () => {
expect(truncatedEventTitle).toContain('...');
expect(truncatedEventDescription).toContain('...');
});
test('Testing all events button', async () => {
localStorage.setItem('UserType', 'SUPERADMIN');
render(
<MockedProvider mocks={mocks}>
<BrowserRouter>
<I18nextProvider i18n={i18nForTest}>
<LeftDrawerEvent {...props} />
</I18nextProvider>
</BrowserRouter>
</MockedProvider>
);

userEvent.click(screen.getByTestId('allEventsBtn'));
expect(global.window.location.pathname).toBe(
`/orgevents/id=${props.event.organization._id}`
);
});
});
14 changes: 14 additions & 0 deletions src/components/LeftDrawerEvent/LeftDrawerEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,20 @@ const leftDrawerEvent = ({
eventId={event._id}
key={`${event?._id || 'loading'}Stats`}
/>
<Button
variant="light"
data-testid="allEventsBtn"
className="text-secondary"
aria-label="allEvents"
onClick={(): void => {
history.push(`/orgevents/id=${event.organization._id}`);
}}
>
<div className={styles.iconWrapper}>
<IconComponent name="Events" fill="var(--bs-secondary)" />
</div>
All Events
</Button>
</div>

{/* Profile Section & Logout Btn */}
Expand Down
22 changes: 15 additions & 7 deletions src/components/Loader/Loader.test.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom';

import Loader from './Loader';

describe('Testing Loader component', () => {
test('Component should be rendered properly', () => {
render(
<BrowserRouter>
<Loader />
</BrowserRouter>
);
render(<Loader />);

expect(screen.getByTestId('spinner-wrapper')).toBeInTheDocument();
expect(screen.getByTestId('spinner')).toBeInTheDocument();
});

test('Component should render on custom sizes', () => {
render(<Loader size="sm" />);

expect(screen.getByTestId('spinner-wrapper')).toBeInTheDocument();
expect(screen.getByTestId('spinner')).toBeInTheDocument();
});

test('Component should render with large size', () => {
render(<Loader size="lg" />);

expect(screen.getByTestId('spinner-wrapper')).toBeInTheDocument();
expect(screen.getByTestId('spinner')).toBeInTheDocument();
Expand Down

0 comments on commit 11caf11

Please sign in to comment.