From 23f034d1026159758764def02ef1c6e3e47db2ec Mon Sep 17 00:00:00 2001
From: Kanhaiya yadav <93936630+kanhaiya04@users.noreply.github.com>
Date: Mon, 13 Nov 2023 22:08:33 +0530
Subject: [PATCH 1/2] created a return button on event dashboard (#1057)
---
.../LeftDrawerEvent/LeftDrawerEvent.test.tsx | 19 ++++++++++++++++++-
.../LeftDrawerEvent/LeftDrawerEvent.tsx | 14 ++++++++++++++
2 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx b/src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx
index 0fabcd2c55..92d0ac32ad 100644
--- a/src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx
+++ b/src/components/LeftDrawerEvent/LeftDrawerEvent.test.tsx
@@ -18,7 +18,7 @@ const props: InterfaceLeftDrawerProps = {
title: 'Test Event',
description: 'Test Description',
organization: {
- _id: 'Test Organization',
+ _id: 'TestOrganization',
},
},
hideDrawer: false,
@@ -218,4 +218,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(
+
+
+
+
+
+
+
+ );
+
+ userEvent.click(screen.getByTestId('allEventsBtn'));
+ expect(global.window.location.pathname).toBe(
+ `/orgevents/id=${props.event.organization._id}`
+ );
+ });
});
diff --git a/src/components/LeftDrawerEvent/LeftDrawerEvent.tsx b/src/components/LeftDrawerEvent/LeftDrawerEvent.tsx
index 2e3ac65cde..2d41b4503f 100644
--- a/src/components/LeftDrawerEvent/LeftDrawerEvent.tsx
+++ b/src/components/LeftDrawerEvent/LeftDrawerEvent.tsx
@@ -130,6 +130,20 @@ const leftDrawerEvent = ({
eventId={event._id}
key={`${event?._id || 'loading'}Stats`}
/>
+
{/* Profile Section & Logout Btn */}
From 98df95d3062ee1284be779cc63849e7086f57837 Mon Sep 17 00:00:00 2001
From: Akhilender Bongirwar
<112749383+akhilender-bongirwar@users.noreply.github.com>
Date: Tue, 14 Nov 2023 22:43:00 +0530
Subject: [PATCH 2/2] test: Loader Component 100% Test Coverage and Fix
Uncovered Lines (#1047)
* test: Achieve 100% Test Coverage and Fix Uncovered Lines
- Improved the test coverage for the Loader component, addressing the previously uncovered lines and ensuring that all tests pass successfully.
- Added a test to ensure that the component renders correctly with a custom 'sm' size. I verified that both the spinner-wrapper and
spinner elements are present and that the correct class is applied.
- Added a test to ensure that the component renders correctly with a 'lg' size. I verified that the spinner element has the appropriate class.
- Added a test to ensure that the component renders correctly with an 'xl' size. I verified that the spinner element has the correct class.
With these new tests, I now have 100% test coverage, and there are no more uncovered lines. The Loader component is thoroughly tested for
different size scenarios, and all tests pass successfully.
Signed-off-by: Akhilender
* Fixed linting in Loader component
Signed-off-by: Akhilender
* Test: Increasing the test level
- Trying to meet the code coverage level for Loader component.
Signed-off-by: Akhilender
* Fixed Linting
Signed-off-by: Akhilender
* fix: Linting
Signed-off-by: Akhilender
* Improving test coverage for Loader Component
- Fixed lint errors
Signed-off-by: Akhilender
* test: Improving the tests on the Loader Component
- Added a new aspect in the test-case1
Signed-off-by: Akhilender
* Fixed: Removed runtime-generated classes from testing
- Eliminated all checks for classes associated with bootstrap components assigned at runtime.
- Recognized that validating classes assigned during runtime is inappropriate.
Signed-off-by: Akhilender
---------
Signed-off-by: Akhilender
---
src/components/Loader/Loader.test.tsx | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/components/Loader/Loader.test.tsx b/src/components/Loader/Loader.test.tsx
index c182c73f4f..c512b480e3 100644
--- a/src/components/Loader/Loader.test.tsx
+++ b/src/components/Loader/Loader.test.tsx
@@ -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(
-
-
-
- );
+ render();
+
+ expect(screen.getByTestId('spinner-wrapper')).toBeInTheDocument();
+ expect(screen.getByTestId('spinner')).toBeInTheDocument();
+ });
+
+ test('Component should render on custom sizes', () => {
+ render();
+
+ expect(screen.getByTestId('spinner-wrapper')).toBeInTheDocument();
+ expect(screen.getByTestId('spinner')).toBeInTheDocument();
+ });
+
+ test('Component should render with large size', () => {
+ render();
expect(screen.getByTestId('spinner-wrapper')).toBeInTheDocument();
expect(screen.getByTestId('spinner')).toBeInTheDocument();