From 747d1393aec5b6edf69e971603e7f468803238e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frane=20Poli=C4=87?= <16856471+fPolic@users.noreply.github.com> Date: Mon, 12 Jan 2026 09:14:53 +0100 Subject: [PATCH] fix: refactor graph query argument in a test (#14513) --- .../__tests__/cart/store/cart.completion.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/integration-tests/modules/__tests__/cart/store/cart.completion.ts b/integration-tests/modules/__tests__/cart/store/cart.completion.ts index 3154c24383..4a155ba7b9 100644 --- a/integration-tests/modules/__tests__/cart/store/cart.completion.ts +++ b/integration-tests/modules/__tests__/cart/store/cart.completion.ts @@ -721,12 +721,10 @@ medusaIntegrationTestRunner({ validateHook = undefined - const paymentSessionQuery = await query.graph({ + const paymentCollectionQuery = await query.graph({ entity: "payment_collection", - variables: { - filters: { - id: paymentSession.payment_collection_id, - }, + filters: { + id: paymentSession.payment_collection_id, }, fields: [ "*", @@ -738,7 +736,7 @@ medusaIntegrationTestRunner({ }) // expects the payment to be refunded and a new payment session to be created - expect(paymentSessionQuery.data[0].payments[0]).toEqual( + expect(paymentCollectionQuery.data[0].payments[0]).toEqual( expect.objectContaining({ amount: 3000, payment_session_id: paymentSession.id, @@ -755,9 +753,13 @@ medusaIntegrationTestRunner({ ], }) ) - expect(paymentSessionQuery.data[0].payment_sessions[0].id).not.toBe( - paymentSession.id - ) + + const sessions = paymentCollectionQuery.data[0].payment_sessions + expect(sessions).toHaveLength(1) + + expect(sessions[0].id).toBeDefined() + expect(sessions[0].id).not.toBe(paymentSession.id) + expect(sessions[0].status).toBe("pending") }) it("should complete cart when payment webhook and storefront are called in simultaneously", async () => {