feat(products,types,pricing): allow scoping products by collection_id + pricing by currency_code (#4965)
* chore: allow scoping products by collection_id * chore: scope money amounts by currency code + change category_ids to category_id * chore: add an extra product to test without collection --------- Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
1 parent
b71776738c
commit
66bd9a835c
11 files changed
+438
-140
No files matched your search
@@ -39,7 +39,7 @@ describe("MoneyAmount Service", () => {
|
||||
})
|
||||
|
||||
describe("list", () => {
|
||||
it("list moneyAmounts", async () => {
|
||||
it("should list all moneyAmounts", async () => {
|
||||
const moneyAmountsResult = await service.list()
|
||||
|
||||
expect(moneyAmountsResult).toEqual([
|
||||
@@ -58,7 +58,7 @@ describe("MoneyAmount Service", () => {
|
||||
])
|
||||
})
|
||||
|
||||
it("list moneyAmounts by id", async () => {
|
||||
it("should list moneyAmounts by id", async () => {
|
||||
const moneyAmountsResult = await service.list({
|
||||
id: ["money-amount-USD"],
|
||||
})
|
||||
@@ -70,7 +70,7 @@ describe("MoneyAmount Service", () => {
|
||||
])
|
||||
})
|
||||
|
||||
it("list moneyAmounts with relations and selects", async () => {
|
||||
it("should list moneyAmounts with relations and selects", async () => {
|
||||
const moneyAmountsResult = await service.list(
|
||||
{
|
||||
id: ["money-amount-USD"],
|
||||
@@ -94,6 +94,31 @@ describe("MoneyAmount Service", () => {
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
it("should list moneyAmounts scoped by currency_code", async () => {
|
||||
const moneyAmountsResult = await service.list(
|
||||
{
|
||||
currency_code: ["USD"],
|
||||
},
|
||||
{
|
||||
select: ["id", "min_quantity", "currency.code"],
|
||||
relations: ["currency"],
|
||||
}
|
||||
)
|
||||
|
||||
const serialized = JSON.parse(JSON.stringify(moneyAmountsResult))
|
||||
|
||||
expect(serialized).toEqual([
|
||||
{
|
||||
id: "money-amount-USD",
|
||||
min_quantity: "1",
|
||||
currency_code: "USD",
|
||||
currency: {
|
||||
code: "USD",
|
||||
},
|
||||
},
|
||||
])
|
||||
})
|
||||
})
|
||||
|
||||
describe("listAndCount", () => {
|
||||
|
||||
Reference in new issue
Block a user