File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -236,15 +236,21 @@ describe('removeItem', () => {
236
236
} )
237
237
238
238
describe ( 'loadCart' , ( ) => {
239
- it ( 'properly merges a new cartDetails into the current cartDetails' , ( ) => {
239
+ it ( 'properly merges a new cartDetails into the current cartDetails excluding timestamp ' , ( ) => {
240
240
const cart1 = mockCart ( )
241
241
const cart2 = mockCart ( undefined , { name : 'Carrots' } , { name : 'Broccoli' } )
242
242
243
+ // Destructure to exclude the timestamp from both cartDetails
244
+ const { timestamp : timestamp1 , ...cart1DetailsWithoutTimestamp } =
245
+ cart1 . cartDetails
246
+ const { timestamp : timestamp2 , ...cart2DetailsWithoutTimestamp } =
247
+ cart2 . cartDetails
248
+
243
249
const result = reducer ( cart1 , actions . loadCart ( cart2 . cartDetails ) )
244
250
245
251
expect ( result . cartDetails ) . toEqual ( {
246
- ...cart1 . cartDetails ,
247
- ...cart2 . cartDetails
252
+ ...cart1DetailsWithoutTimestamp ,
253
+ ...cart2DetailsWithoutTimestamp
248
254
} )
249
255
expect ( result . totalPrice ) . toBe ( 3600 )
250
256
expect ( result . cartCount ) . toBe ( 12 )
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " use-shopping-cart" ,
3
- "version" : " 3.2.0-alpha.1 " ,
3
+ "version" : " 3.2.0" ,
4
4
"description" : " Shopping cart state and logic for Stripe" ,
5
5
"author" : " dayhaysoos" ,
6
6
"license" : " MIT" ,
123
123
"uuid" : " ^8.3.2"
124
124
}
125
125
}
126
+
You can’t perform that action at this time.
0 commit comments