From 08ed0dfcee0a8698bfff56625d83af5d4672740b Mon Sep 17 00:00:00 2001 From: Tanmayi Manku Date: Thu, 14 Dec 2023 21:24:42 +0530 Subject: [PATCH 1/3] Update test cases --- src/__tests__/MyReservationsList.test.js | 44 ++++++------------- .../__snapshots__/AddNewCar.test.js.snap | 30 ++++++------- .../MyReservationsList.test.js.snap | 18 ++++++++ .../__snapshots__/SignIn.test.js.snap | 12 ++--- .../__snapshots__/SignUp.test.js.snap | 20 ++++----- .../MyReservations/EachReservation.js | 13 ++++++ .../MyReservations/MyReservationsList.js | 12 +++-- 7 files changed, 79 insertions(+), 70 deletions(-) create mode 100644 src/components/MyReservations/EachReservation.js diff --git a/src/__tests__/MyReservationsList.test.js b/src/__tests__/MyReservationsList.test.js index d9896c3..ba3dae6 100644 --- a/src/__tests__/MyReservationsList.test.js +++ b/src/__tests__/MyReservationsList.test.js @@ -1,44 +1,26 @@ -import '@testing-library/jest-dom'; -import { render } from '@testing-library/react'; import React from 'react'; -import { MemoryRouter } from 'react-router-dom'; +import { render } from '@testing-library/react'; +import EachReservation from 'components/MyReservations/EachReservation'; import { Provider } from 'react-redux'; -import configureMockStore from 'redux-mock-store'; -import MyReservations from '../pages/LandingPage/MyReservation/MyReservation'; - -const mockStore = configureMockStore(); +import store from 'redux/store'; +import { MemoryRouter } from 'react-router-dom'; -describe('MyReservations Component', () => { - it('renders reservations present', () => { - const store = mockStore({ - authentication: { - authenticatedUser: { - username: 'testuser', - }, - status: 'succeeded', - }, - reservation: { - reservations: [ - { - date: '2023-10-10', - city: 'City A', - }, - { - date: '2022-11-11', - city: 'City B', - }, - ], - }, - }); +describe('EachReservation Component', () => { + it('renders reservation details', () => { + const reservation = { + id: 1, + car: { name: 'Test Car' }, + date: '2023-01-01', + city: 'Test City', + }; const { container } = render( - + , ); - expect(container).toMatchSnapshot(); }); }); diff --git a/src/__tests__/__snapshots__/AddNewCar.test.js.snap b/src/__tests__/__snapshots__/AddNewCar.test.js.snap index e76755e..cc205c6 100644 --- a/src/__tests__/__snapshots__/AddNewCar.test.js.snap +++ b/src/__tests__/__snapshots__/AddNewCar.test.js.snap @@ -10,7 +10,7 @@ Object { class="add-new-car css-i51pdu" >