Skip to content

Commit

Permalink
(PC-31778) refacto wording after review
Browse files Browse the repository at this point in the history
  • Loading branch information
yleclercq-pass committed Sep 20, 2024
1 parent a83096b commit d4062f0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ exports[`EndedBookings should render correctly 1`] = `
},
"token": "352UW5",
"totalAmount": 1900,
"userReaction": null,
},
{
"confirmationDate": "2021-02-15T23:01:37.925926",
Expand Down Expand Up @@ -297,6 +298,7 @@ exports[`EndedBookings should render correctly 1`] = `
},
"token": "352UW5",
"totalAmount": 1900,
"userReaction": null,
},
]
}
Expand Down Expand Up @@ -787,6 +789,7 @@ exports[`EndedBookings should render correctly 1`] = `
},
"token": "352UW5",
"totalAmount": 1900,
"userReaction": null,
}
}
style={
Expand Down
3 changes: 1 addition & 2 deletions src/features/bookings/fixtures/bookingsSnap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { ReadonlyDeep } from 'type-fest'
import {
BookingCancellationReasons,
BookingsResponse,
ReactionTypeEnum,
SubcategoryIdEnum,
WithdrawalTypeEnum,
} from 'api/gen'
Expand Down Expand Up @@ -108,7 +107,7 @@ export const bookingsSnap = toMutable({
totalAmount: 1900,
token: '352UW5',
quantity: 10,
userReaction: ReactionTypeEnum.LIKE,
userReaction: null,
stock: {
id: 150230,
price: 400,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ describe('Bookings', () => {
fireEvent.press(await screen.findByText('En cours'))

expect(mockMutate).toHaveBeenCalledWith({
reactions: [{ offerId: 147874, reactionType: ReactionTypeEnum.NO_REACTION }],
reactions: [
{ offerId: 147874, reactionType: ReactionTypeEnum.NO_REACTION },
{ offerId: 147874, reactionType: ReactionTypeEnum.NO_REACTION },
],
})
})
})
Expand Down
6 changes: 3 additions & 3 deletions src/features/bookings/pages/Bookings/Bookings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ export function Bookings() {
.filter((ended_booking) => ended_booking.userReaction === null)
.map((booking) => booking.stock.offer.id) ?? []

const bookingsTest = bookingsToUpdate.map((bookingId) => ({
const mutationPayload = bookingsToUpdate.map((bookingId) => ({
offerId: bookingId,
reactionType: ReactionTypeEnum.NO_REACTION,
}))
if (bookingsTest.length > 0) {
addReaction({ reactions: bookingsTest })
if (mutationPayload.length > 0) {
addReaction({ reactions: mutationPayload })
}
}, [addReaction, bookings?.ended_bookings])

Expand Down
2 changes: 1 addition & 1 deletion src/features/bookings/pages/Bookings/Bookings.web.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Bookings', () => {
renderBookings(bookingsSnap)

await waitFor(() => {
expect(useBookings).toHaveBeenCalledTimes(1)
expect(useBookings).toHaveBeenCalledTimes(2)
})
})

Expand Down

0 comments on commit d4062f0

Please sign in to comment.