From c90868d1383e433116dd38cbb2da03e3555f8fb1 Mon Sep 17 00:00:00 2001 From: Akhilender Date: Sat, 11 Nov 2023 18:28:34 +0530 Subject: [PATCH] Test: Increasing the test level - Trying to meet the code coverage level for Loader component. Signed-off-by: Akhilender --- src/components/Loader/Loader.test.tsx | 35 +++------------------------ 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/src/components/Loader/Loader.test.tsx b/src/components/Loader/Loader.test.tsx index 50ca448b48..923c2fc6b8 100644 --- a/src/components/Loader/Loader.test.tsx +++ b/src/components/Loader/Loader.test.tsx @@ -1,27 +1,17 @@ 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( - - - - ); + render(); const spinner = screen.getByTestId('spinner'); expect(screen.getByTestId('spinner-wrapper')).toBeInTheDocument(); @@ -32,11 +22,7 @@ describe('Testing Loader component', () => { }); test('Component should render with large size', () => { - render( - - - - ); + render(); const spinner = screen.getByTestId('spinner'); expect(screen.getByTestId('spinner-wrapper')).toBeInTheDocument(); @@ -45,19 +31,4 @@ describe('Testing Loader component', () => { '_spinnerLg_1vy2z_15 spinner-border text-primary' ); }); - - test('renders with extra-large size', () => { - render( - - - - ); - - const spinner = screen.getByTestId('spinner'); - expect(screen.getByTestId('spinner-wrapper')).toBeInTheDocument(); - expect(spinner).toBeInTheDocument(); - expect(spinner).toHaveClass( - '_spinnerXl_1vy2z_9 spinner-border text-primary' - ); - }); });