fix(core-flows): customer id filter not working in getOrderDetails (#13695)

As discussed, fixed the get order detail and also changed the remotequery to graph a bunch of workflows
This commit is contained in:
William Bouchard
2025-10-09 08:13:12 -04:00
committed by GitHub
parent 82f3b0413a
commit 924564bee5
17 changed files with 259 additions and 184 deletions

View File

@@ -0,0 +1,72 @@
import { getOrderDetailWorkflow } from "@medusajs/core-flows"
import { medusaIntegrationTestRunner } from "@medusajs/test-utils"
import { OrderDTO } from "@medusajs/types"
import { createOrderFixture, prepareDataFixtures } from "./__fixtures__"
jest.setTimeout(50000)
medusaIntegrationTestRunner({
env: {},
testSuite: ({ getContainer }) => {
let container
beforeAll(() => {
container = getContainer()
})
describe("Get order detail workflow", () => {
let order: OrderDTO
describe("createOrderChangeWorkflow", () => {
beforeEach(async () => {
const fixtures = await prepareDataFixtures({
container,
})
order = await createOrderFixture({
container,
product: fixtures.product,
location: fixtures.location,
inventoryItem: fixtures.inventoryItem,
})
})
it("should get an order based on filters", async () => {
const response = await getOrderDetailWorkflow(container).run({
input: {
fields: [],
filters: {
customer_id: order.customer_id ?? "",
},
order_id: order.id,
},
throwOnError: false,
})
expect(response).toBeDefined()
})
it("should throw an error when getting order if none is found with the provided customer id", async () => {
const {
errors: [error],
} = await getOrderDetailWorkflow(container).run({
input: {
fields: [],
filters: {
customer_id: "wrong-id",
},
order_id: order.id,
},
throwOnError: false,
})
expect(error.error).toEqual(
expect.objectContaining({
message: `Order id not found: ${order.id}`,
})
)
})
})
})
},
})