Skip to content

Commit

Permalink
Merge pull request #19 from tan12082001/fix-bugs-review-2
Browse files Browse the repository at this point in the history
Fix bugs review 2
  • Loading branch information
tan12082001 authored Dec 14, 2023
2 parents 7120a84 + 3a9f798 commit 18e5aa3
Show file tree
Hide file tree
Showing 19 changed files with 158 additions and 153 deletions.
44 changes: 13 additions & 31 deletions src/__tests__/MyReservationsList.test.js
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();
});
});
30 changes: 14 additions & 16 deletions src/__tests__/__snapshots__/AddNewCar.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Object {
class="add-new-car css-i51pdu"
>
<div
class="add-new-string css-1oq5xzy"
class="add-new-string css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -29,7 +29,7 @@ Object {
</div>
</div>
<div
class="add-new-string css-1oq5xzy"
class="add-new-string css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -48,7 +48,7 @@ Object {
</div>
</div>
<div
class="add-new-string css-1oq5xzy"
class="add-new-string css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -67,7 +67,7 @@ Object {
</div>
</div>
<div
class="add-new-string css-1oq5xzy"
class="add-new-string css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -86,7 +86,7 @@ Object {
</div>
</div>
<div
class="add-new-string css-1oq5xzy"
class="add-new-string css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -105,18 +105,17 @@ Object {
</div>
</div>
<div
class="add-new-string css-1ssprdq"
class="add-new-string css-md1mko"
>
<label
class="css-1mcvbvm"
>
Add Image of Car
</label>
<input
accept="image/*"
class="css-iz78xn"
name="Add Image"
type="file"
value=""
/>
</div>
<button
Expand All @@ -134,7 +133,7 @@ Object {
class="add-new-car css-i51pdu"
>
<div
class="add-new-string css-1oq5xzy"
class="add-new-string css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -153,7 +152,7 @@ Object {
</div>
</div>
<div
class="add-new-string css-1oq5xzy"
class="add-new-string css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -172,7 +171,7 @@ Object {
</div>
</div>
<div
class="add-new-string css-1oq5xzy"
class="add-new-string css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -191,7 +190,7 @@ Object {
</div>
</div>
<div
class="add-new-string css-1oq5xzy"
class="add-new-string css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -210,7 +209,7 @@ Object {
</div>
</div>
<div
class="add-new-string css-1oq5xzy"
class="add-new-string css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -229,18 +228,17 @@ Object {
</div>
</div>
<div
class="add-new-string css-1ssprdq"
class="add-new-string css-md1mko"
>
<label
class="css-1mcvbvm"
>
Add Image of Car
</label>
<input
accept="image/*"
class="css-iz78xn"
name="Add Image"
type="file"
value=""
/>
</div>
<button
Expand Down
46 changes: 11 additions & 35 deletions src/__tests__/__snapshots__/MyReservationsList.test.js.snap
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>
`;
12 changes: 6 additions & 6 deletions src/__tests__/__snapshots__/SignIn.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Object {
>
<form
action="#"
class="sign-in-form css-1tqyvtu"
class="sign-in-form css-1u7ueiz"
>
<div
class="form-username css-1oq5xzy"
class="form-username css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -45,7 +45,7 @@ Object {
</div>
</div>
<div
class="form-password css-1oq5xzy"
class="form-password css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand Down Expand Up @@ -108,10 +108,10 @@ Object {
>
<form
action="#"
class="sign-in-form css-1tqyvtu"
class="sign-in-form css-1u7ueiz"
>
<div
class="form-username css-1oq5xzy"
class="form-username css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -130,7 +130,7 @@ Object {
</div>
</div>
<div
class="form-password css-1oq5xzy"
class="form-password css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand Down
20 changes: 10 additions & 10 deletions src/__tests__/__snapshots__/SignUp.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Object {
>
<form
action="#"
class="sign-up-form css-1tqyvtu"
class="sign-up-form css-1u7ueiz"
>
<div
class="form-username css-1oq5xzy"
class="form-username css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -45,7 +45,7 @@ Object {
</div>
</div>
<div
class="form-email css-1oq5xzy"
class="form-email css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -64,7 +64,7 @@ Object {
</div>
</div>
<div
class="password_block css-1oq5xzy"
class="password_block css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand Down Expand Up @@ -98,7 +98,7 @@ Object {
</div>
</div>
<div
class="password_block css-1oq5xzy"
class="password_block css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand Down Expand Up @@ -170,10 +170,10 @@ Object {
>
<form
action="#"
class="sign-up-form css-1tqyvtu"
class="sign-up-form css-1u7ueiz"
>
<div
class="form-username css-1oq5xzy"
class="form-username css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -192,7 +192,7 @@ Object {
</div>
</div>
<div
class="form-email css-1oq5xzy"
class="form-email css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand All @@ -211,7 +211,7 @@ Object {
</div>
</div>
<div
class="password_block css-1oq5xzy"
class="password_block css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand Down Expand Up @@ -245,7 +245,7 @@ Object {
</div>
</div>
<div
class="password_block css-1oq5xzy"
class="password_block css-5zoda1"
>
<label
class="css-1mcvbvm"
Expand Down
3 changes: 3 additions & 0 deletions src/components/Card/DisplayCartCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ const Container = styled(Link)`
border-radius: 8px;
overflow: hidden;
// box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
@media (max-width: 768px) {
min-width: 320px;
}
`;

const Image = styled.img`
Expand Down
Loading

0 comments on commit 18e5aa3

Please sign in to comment.