fix(modules-sdk): Remote Query "order" as config options (#6925)

This commit is contained in:
Carlos R. L. Rodrigues
2024-04-08 08:17:53 +02:00
committed by GitHub
parent 4f88743591
commit dd35a4dbff
8 changed files with 93 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
import { createAdminUser } from "../../../../helpers/create-admin-user"
import { medusaIntegrationTestRunner } from "medusa-test-utils"
import { createAdminUser } from "../../../../helpers/create-admin-user"
jest.setTimeout(50000)
@@ -41,6 +41,18 @@ medusaIntegrationTestRunner({
listResp.data.currencies.find((c) => c.code === "aud")
)
})
it("should correctly list currencies in the correct order", async () => {
const listResp = await api.get(
"/admin/currencies?order=-code",
adminHeaders
)
const first = listResp.data.currencies.shift()
expect(first).toEqual(
expect.objectContaining({ code: "zwl", name: "Zimbabwean Dollar" })
)
})
})
},
})

View File

@@ -798,7 +798,7 @@ medusaIntegrationTestRunner({
)
response = await api.get(
`/admin/promotions/rule-value-options/rules/currency?limit=2`,
`/admin/promotions/rule-value-options/rules/currency?limit=2&order=name`,
adminHeaders
)
@@ -806,14 +806,8 @@ medusaIntegrationTestRunner({
expect(response.data.values.length).toEqual(2)
expect(response.data.values).toEqual(
expect.arrayContaining([
{
label: "United Arab Emirates Dirham",
value: "aed",
},
{
label: "Afghan Afghani",
value: "afn",
},
{ label: "Afghan Afghani", value: "afn" },
{ label: "Albanian Lek", value: "all" },
])
)
@@ -862,8 +856,8 @@ medusaIntegrationTestRunner({
expect(response.data.values.length).toEqual(2)
expect(response.data.values).toEqual(
expect.arrayContaining([
{ label: "Andorra", value: "ad" },
{ label: "United Arab Emirates", value: "ae" },
{ label: "Afghanistan", value: "af" },
{ label: "Albania", value: "al" },
])
)