Skip to content

Commit

Permalink
Fixes #2670 : Refactored src/screen/PageNotFound component test from …
Browse files Browse the repository at this point in the history
…jest to vitest (#2708)

* Refactored Refactor: src/screens/PageNotFound from Jest to Vitest

* Refactored :src/screens/PageNotFound from Jest to Vitest

* Refactored :src/screens/PageNotFound from Jest to Vitest

* Refactored :src/screens/PageNotFound from Jest to Vitest
  • Loading branch information
rafidoth authored Dec 22, 2024
1 parent 8a21cbb commit a295db3
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { store } from 'state/store';
import PageNotFound from './PageNotFound';
import i18nForTest from 'utils/i18nForTest';
import useLocalStorage from 'utils/useLocalstorage';

import { it, expect, describe } from 'vitest';
const { setItem } = useLocalStorage();

describe('Testing Page not found component', () => {
test('Component should be rendered properly for User', () => {
it('should render component properly for User', () => {
//setItem('AdminFor', undefined);
render(
<BrowserRouter>
Expand All @@ -24,15 +24,15 @@ describe('Testing Page not found component', () => {
</BrowserRouter>,
);

expect(screen.getByText(/Talawa User/i)).toBeTruthy();
expect(screen.getByText(/404/i)).toBeTruthy();
expect(screen.getByText(/Talawa User/i)).toBeInTheDocument();
expect(screen.getByText(/404/i)).toBeInTheDocument();
expect(
screen.getByText(/Oops! The Page you requested was not found!/i),
).toBeTruthy();
expect(screen.getByText(/Back to Home/i)).toBeTruthy();
).toBeInTheDocument();
expect(screen.getByText(/Back to Home/i)).toBeInTheDocument();
});

test('Component should be rendered properly for ADMIN or SUPERADMIN', () => {
it('should render properly for ADMIN or SUPERADMIN', () => {
setItem('AdminFor', [
{
_id: '6537904485008f171cf29924',
Expand All @@ -49,11 +49,11 @@ describe('Testing Page not found component', () => {
</BrowserRouter>,
);

expect(screen.getByText(/Talawa Admin Portal/i)).toBeTruthy();
expect(screen.getByText(/404/i)).toBeTruthy();
expect(screen.getByText(/Talawa Admin Portal/i)).toBeInTheDocument();
expect(screen.getByText(/404/i)).toBeInTheDocument();
expect(
screen.getByText(/Oops! The Page you requested was not found!/i),
).toBeTruthy();
expect(screen.getByText(/Back to Home/i)).toBeTruthy();
).toBeInTheDocument();
expect(screen.getByText(/Back to Home/i)).toBeInTheDocument();
});
});

0 comments on commit a295db3

Please sign in to comment.