@@ -26,8 +26,8 @@ medusaIntegrationTestRunner({
26
26
items : [
27
27
{
28
28
title : "Custom Item 2" ,
29
- quantity : 1 ,
30
- unit_price : 50 ,
29
+ quantity : 2 ,
30
+ unit_price : 25 ,
31
31
} ,
32
32
] ,
33
33
sales_channel_id : "test" ,
@@ -152,7 +152,7 @@ medusaIntegrationTestRunner({
152
152
items : [
153
153
{
154
154
id : item . id ,
155
- quantity : 1 ,
155
+ quantity : 2 ,
156
156
} ,
157
157
] ,
158
158
} ,
@@ -208,7 +208,7 @@ medusaIntegrationTestRunner({
208
208
items : [
209
209
{
210
210
id : item . id ,
211
- quantity : 1 ,
211
+ quantity : 2 ,
212
212
} ,
213
213
] ,
214
214
} ,
@@ -222,14 +222,15 @@ medusaIntegrationTestRunner({
222
222
expect . objectContaining ( {
223
223
id : expect . any ( String ) ,
224
224
title : "Custom Item 2" ,
225
- unit_price : 50 ,
226
- quantity : 1 ,
225
+ unit_price : 25 ,
226
+ quantity : 2 ,
227
227
subtotal : 50 ,
228
228
total : 50 ,
229
229
fulfilled_total : 50 ,
230
230
return_requested_total : 50 ,
231
231
detail : expect . objectContaining ( {
232
- return_requested_quantity : 1 ,
232
+ quantity : 2 ,
233
+ return_requested_quantity : 2 ,
233
234
} ) ,
234
235
} ) ,
235
236
] ) ,
@@ -284,6 +285,32 @@ medusaIntegrationTestRunner({
284
285
} )
285
286
)
286
287
288
+ // updated the requested quantitty
289
+ const updateReturnItemActionId =
290
+ result . data . order_preview . items [ 0 ] . actions [ 0 ] . id
291
+ result = await api . post (
292
+ `/admin/returns/${ returnId } /request-items/${ updateReturnItemActionId } ` ,
293
+ {
294
+ quantity : 2 ,
295
+ internal_note : "Test internal note" ,
296
+ } ,
297
+ adminHeaders
298
+ )
299
+
300
+ expect ( result . data . order_preview ) . toEqual (
301
+ expect . objectContaining ( {
302
+ id : order . id ,
303
+ items : expect . arrayContaining ( [
304
+ expect . objectContaining ( {
305
+ detail : expect . objectContaining ( {
306
+ quantity : 2 ,
307
+ return_requested_quantity : 2 ,
308
+ } ) ,
309
+ } ) ,
310
+ ] ) ,
311
+ } )
312
+ )
313
+
287
314
result = await api . post (
288
315
`/admin/returns/${ returnId } /shipping-method` ,
289
316
{
@@ -299,12 +326,20 @@ medusaIntegrationTestRunner({
299
326
expect . objectContaining ( {
300
327
id : expect . any ( String ) ,
301
328
title : "Custom Item 2" ,
302
- unit_price : 50 ,
303
- quantity : 1 ,
329
+ unit_price : 25 ,
330
+ quantity : 2 ,
304
331
subtotal : 50 ,
305
332
total : 50 ,
306
333
fulfilled_total : 50 ,
307
334
return_requested_total : 50 ,
335
+ actions : expect . arrayContaining ( [
336
+ expect . objectContaining ( {
337
+ details : expect . objectContaining ( {
338
+ quantity : 2 ,
339
+ } ) ,
340
+ internal_note : "Test internal note" ,
341
+ } ) ,
342
+ ] ) ,
308
343
} ) ,
309
344
] ) ,
310
345
shipping_methods : expect . arrayContaining ( [
@@ -331,8 +366,8 @@ medusaIntegrationTestRunner({
331
366
expect . objectContaining ( {
332
367
id : expect . any ( String ) ,
333
368
title : "Custom Item 2" ,
334
- unit_price : 50 ,
335
- quantity : 1 ,
369
+ unit_price : 25 ,
370
+ quantity : 2 ,
336
371
subtotal : 50 ,
337
372
total : 50 ,
338
373
fulfilled_total : 50 ,
@@ -372,6 +407,34 @@ medusaIntegrationTestRunner({
372
407
adminHeaders
373
408
)
374
409
410
+ // updates the shipping method price
411
+ const updateShippingActionId =
412
+ result . data . order_preview . shipping_methods [ 1 ] . actions [ 0 ] . id
413
+ result = await api . post (
414
+ `/admin/returns/${ returnId } /shipping-method/${ updateShippingActionId } ` ,
415
+ {
416
+ custom_price : 1002 ,
417
+ internal_note : "cx agent note" ,
418
+ } ,
419
+ adminHeaders
420
+ )
421
+
422
+ expect ( result . data . order_preview . shipping_methods ) . toHaveLength ( 2 )
423
+ expect ( result . data . order_preview . shipping_methods [ 1 ] ) . toEqual (
424
+ expect . objectContaining ( {
425
+ id : expect . any ( String ) ,
426
+ name : "Return shipping" ,
427
+ amount : 1002 ,
428
+ subtotal : 1002 ,
429
+ total : 1002 ,
430
+ actions : [
431
+ expect . objectContaining ( {
432
+ internal_note : "cx agent note" ,
433
+ } ) ,
434
+ ] ,
435
+ } )
436
+ )
437
+
375
438
result = await api . post (
376
439
`/admin/returns/${ returnId } /request` ,
377
440
{ } ,
@@ -385,8 +448,8 @@ medusaIntegrationTestRunner({
385
448
expect . objectContaining ( {
386
449
id : expect . any ( String ) ,
387
450
title : "Custom Item 2" ,
388
- unit_price : 50 ,
389
- quantity : 1 ,
451
+ unit_price : 25 ,
452
+ quantity : 2 ,
390
453
subtotal : 50 ,
391
454
total : 50 ,
392
455
fulfilled_total : 50 ,
@@ -397,9 +460,9 @@ medusaIntegrationTestRunner({
397
460
expect . objectContaining ( {
398
461
id : expect . any ( String ) ,
399
462
name : "Return shipping" ,
400
- amount : 1000 ,
401
- subtotal : 1000 ,
402
- total : 1000 ,
463
+ amount : 1002 ,
464
+ subtotal : 1002 ,
465
+ total : 1002 ,
403
466
} ) ,
404
467
] ) ,
405
468
} )
@@ -418,8 +481,8 @@ medusaIntegrationTestRunner({
418
481
expect . objectContaining ( {
419
482
id : expect . any ( String ) ,
420
483
title : "Custom Item 2" ,
421
- unit_price : 50 ,
422
- quantity : 1 ,
484
+ unit_price : 25 ,
485
+ quantity : 2 ,
423
486
subtotal : 50 ,
424
487
total : 50 ,
425
488
fulfilled_total : 50 ,
@@ -430,9 +493,9 @@ medusaIntegrationTestRunner({
430
493
expect . objectContaining ( {
431
494
id : expect . any ( String ) ,
432
495
name : "Return shipping" ,
433
- amount : 1000 ,
434
- subtotal : 1000 ,
435
- total : 1000 ,
496
+ amount : 1002 ,
497
+ subtotal : 1002 ,
498
+ total : 1002 ,
436
499
} ) ,
437
500
] ) ,
438
501
} )
0 commit comments