fix(orchestration): Throw if not exists using filters (#9275)

This commit is contained in:
Adrien de Peretti
2024-09-24 17:12:04 +02:00
committed by GitHub
parent b4b1a48987
commit 802f204d31
4 changed files with 92 additions and 18 deletions

View File

@@ -231,6 +231,40 @@ medusaIntegrationTestRunner({
})
})
it(`should throw if not exists`, async () => {
const err = await query
.graph(
{
entity: "product",
fields: ["id", "title", "variants.*", "variants.prices.amount"],
filters: {
id: "non-existing-id",
variants: {
prices: {
amount: {
$gt: 100,
},
},
},
},
},
{
throwIfKeyNotFound: true,
}
)
.catch((err) => {
return err
})
expect(err).toEqual(
expect.objectContaining({
message: expect.stringContaining(
"Product id not found: non-existing-id"
),
})
)
})
it(`should perform cross module query and apply filters correctly to the correct modules [1]`, async () => {
const { data } = await query.graph({
entity: "product",