-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from tan12082001/fix-bugs-review-2
Fix bugs review 2
- Loading branch information
Showing
19 changed files
with
158 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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( | ||
<Provider store={store}> | ||
<MemoryRouter> | ||
<MyReservations /> | ||
<EachReservation reservation={reservation} /> | ||
</MemoryRouter> | ||
</Provider>, | ||
); | ||
|
||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 11 additions & 35 deletions
46
src/__tests__/__snapshots__/MyReservationsList.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`MyReservations Component renders reservations present 1`] = ` | ||
exports[`EachReservation Component renders reservation details 1`] = ` | ||
<div> | ||
<div | ||
class="my-reservations-page-outer" | ||
class="each-reservation-div" | ||
> | ||
<h1> | ||
My Current Reservations | ||
</h1> | ||
<div | ||
class="my-reservations-inner" | ||
> | ||
<div | ||
class="each-reservation-div" | ||
> | ||
<span> | ||
Car: non nome | ||
</span> | ||
<span> | ||
Date: 2023-10-10 | ||
</span> | ||
<span> | ||
City: City A | ||
</span> | ||
</div> | ||
<div | ||
class="each-reservation-div" | ||
> | ||
<span> | ||
Car: non nome | ||
</span> | ||
<span> | ||
Date: 2022-11-11 | ||
</span> | ||
<span> | ||
City: City B | ||
</span> | ||
</div> | ||
</div> | ||
<span> | ||
Booked For 🚗: Test Car | ||
</span> | ||
<span> | ||
Reservation is on 📆: 2023-01-01 | ||
</span> | ||
<span> | ||
Reservation is at 📍: Test City | ||
</span> | ||
</div> | ||
</div> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.