diff --git a/__snapshots__/features/bookings/pages/EndedBookings/EndedBookings.native.test.tsx.native-snap b/__snapshots__/features/bookings/pages/EndedBookings/EndedBookings.native.test.tsx.native-snap index c9f066779b2..ba573679033 100644 --- a/__snapshots__/features/bookings/pages/EndedBookings/EndedBookings.native.test.tsx.native-snap +++ b/__snapshots__/features/bookings/pages/EndedBookings/EndedBookings.native.test.tsx.native-snap @@ -253,6 +253,7 @@ exports[`EndedBookings should render correctly 1`] = ` }, "token": "352UW5", "totalAmount": 1900, + "userReaction": null, }, { "confirmationDate": "2021-02-15T23:01:37.925926", @@ -297,6 +298,7 @@ exports[`EndedBookings should render correctly 1`] = ` }, "token": "352UW5", "totalAmount": 1900, + "userReaction": null, }, ] } @@ -787,6 +789,7 @@ exports[`EndedBookings should render correctly 1`] = ` }, "token": "352UW5", "totalAmount": 1900, + "userReaction": null, } } style={ diff --git a/src/features/bookings/fixtures/bookingsSnap.ts b/src/features/bookings/fixtures/bookingsSnap.ts index 8802156f3d1..ac1d8c2102b 100644 --- a/src/features/bookings/fixtures/bookingsSnap.ts +++ b/src/features/bookings/fixtures/bookingsSnap.ts @@ -3,7 +3,6 @@ import type { ReadonlyDeep } from 'type-fest' import { BookingCancellationReasons, BookingsResponse, - ReactionTypeEnum, SubcategoryIdEnum, WithdrawalTypeEnum, } from 'api/gen' @@ -108,7 +107,7 @@ export const bookingsSnap = toMutable({ totalAmount: 1900, token: '352UW5', quantity: 10, - userReaction: ReactionTypeEnum.LIKE, + userReaction: null, stock: { id: 150230, price: 400, diff --git a/src/features/bookings/pages/Bookings/Bookings.native.test.tsx b/src/features/bookings/pages/Bookings/Bookings.native.test.tsx index 512393af38c..8a473c47e07 100644 --- a/src/features/bookings/pages/Bookings/Bookings.native.test.tsx +++ b/src/features/bookings/pages/Bookings/Bookings.native.test.tsx @@ -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 }, + ], }) }) }) diff --git a/src/features/bookings/pages/Bookings/Bookings.tsx b/src/features/bookings/pages/Bookings/Bookings.tsx index 28dbb34b0b8..0c9e34f7f17 100644 --- a/src/features/bookings/pages/Bookings/Bookings.tsx +++ b/src/features/bookings/pages/Bookings/Bookings.tsx @@ -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]) diff --git a/src/features/bookings/pages/Bookings/Bookings.web.test.tsx b/src/features/bookings/pages/Bookings/Bookings.web.test.tsx index a238b3fa1ab..61689727ba2 100644 --- a/src/features/bookings/pages/Bookings/Bookings.web.test.tsx +++ b/src/features/bookings/pages/Bookings/Bookings.web.test.tsx @@ -52,7 +52,7 @@ describe('Bookings', () => { renderBookings(bookingsSnap) await waitFor(() => { - expect(useBookings).toHaveBeenCalledTimes(1) + expect(useBookings).toHaveBeenCalledTimes(2) }) }) diff --git a/src/features/home/components/IncomingReactionModalContainer/IncomingReactionModalContainer.native.test.tsx b/src/features/home/components/IncomingReactionModalContainer/IncomingReactionModalContainer.native.test.tsx index e1fa5848481..d55dd6f2a88 100644 --- a/src/features/home/components/IncomingReactionModalContainer/IncomingReactionModalContainer.native.test.tsx +++ b/src/features/home/components/IncomingReactionModalContainer/IncomingReactionModalContainer.native.test.tsx @@ -142,8 +142,12 @@ describe('IncomingReactionModalContainer', () => { await waitFor(() => { expect(mockMutate).toHaveBeenNthCalledWith(1, { - offerId: bookingsSnap.ended_bookings[0].stock.offer.id, - reactionType: ReactionTypeEnum.LIKE, + reactions: [ + { + offerId: bookingsSnap.ended_bookings[0].stock.offer.id, + reactionType: ReactionTypeEnum.LIKE, + }, + ], }) }) }) @@ -197,8 +201,12 @@ describe('IncomingReactionModalContainer', () => { await waitFor(() => { expect(mockMutate).toHaveBeenNthCalledWith(1, { - offerId: bookingsSnap.ended_bookings[0].stock.offer.id, - reactionType: ReactionTypeEnum.NO_REACTION, + reactions: [ + { + offerId: bookingsSnap.ended_bookings[0].stock.offer.id, + reactionType: ReactionTypeEnum.NO_REACTION, + }, + ], }) }) })