chore(utils): Add default ordering to the internal service factory list/listAndCount (#6436)
**What** Default ordering. By default, only the top level entity ordering is applied using the primary keys, the relations are default ordered by the foreign keys. It include tests fixing for deterministic data ordering
This commit is contained in:
+13
-11
@@ -46,10 +46,6 @@ describe("PricingModule Service - Currency", () => {
|
||||
const currenciesResult = await service.listCurrencies()
|
||||
|
||||
expect(currenciesResult).toEqual([
|
||||
expect.objectContaining({
|
||||
code: "USD",
|
||||
name: "US Dollar",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
code: "CAD",
|
||||
name: "Canadian Dollar",
|
||||
@@ -58,6 +54,10 @@ describe("PricingModule Service - Currency", () => {
|
||||
code: "EUR",
|
||||
name: "Euro",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
code: "USD",
|
||||
name: "US Dollar",
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
@@ -79,10 +79,6 @@ describe("PricingModule Service - Currency", () => {
|
||||
|
||||
expect(count).toEqual(3)
|
||||
expect(currenciesResult).toEqual([
|
||||
expect.objectContaining({
|
||||
code: "USD",
|
||||
name: "US Dollar",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
code: "CAD",
|
||||
name: "Canadian Dollar",
|
||||
@@ -91,6 +87,10 @@ describe("PricingModule Service - Currency", () => {
|
||||
code: "EUR",
|
||||
name: "Euro",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
code: "USD",
|
||||
name: "US Dollar",
|
||||
}),
|
||||
])
|
||||
})
|
||||
|
||||
@@ -117,8 +117,10 @@ describe("PricingModule Service - Currency", () => {
|
||||
expect(count).toEqual(3)
|
||||
expect(currenciesResult).toEqual([
|
||||
expect.objectContaining({
|
||||
code: "CAD",
|
||||
name: "Canadian Dollar",
|
||||
code: "EUR",
|
||||
name: "Euro",
|
||||
symbol: "€",
|
||||
symbol_native: "€",
|
||||
}),
|
||||
])
|
||||
})
|
||||
@@ -137,7 +139,7 @@ describe("PricingModule Service - Currency", () => {
|
||||
expect(count).toEqual(3)
|
||||
expect(serialized).toEqual([
|
||||
{
|
||||
code: "USD",
|
||||
code: "CAD",
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
+1
-1
@@ -201,7 +201,7 @@ describe("PricingModule Service - MoneyAmount", () => {
|
||||
expect(count).toEqual(3)
|
||||
expect(serialized).toEqual([
|
||||
{
|
||||
id: "money-amount-USD",
|
||||
id: "money-amount-CAD",
|
||||
amount: null,
|
||||
},
|
||||
])
|
||||
|
||||
+8
-10
@@ -273,16 +273,14 @@ describe("PricingModule Service - PriceSetMoneyAmountRules", () => {
|
||||
},
|
||||
])
|
||||
|
||||
const priceSetMoneyAmountRules =
|
||||
await service.listPriceSetMoneyAmountRules(
|
||||
{},
|
||||
{
|
||||
relations: ["price_set_money_amount", "rule_type"],
|
||||
}
|
||||
)
|
||||
|
||||
const created =
|
||||
priceSetMoneyAmountRules[priceSetMoneyAmountRules.length - 1]
|
||||
const [created] = await service.listPriceSetMoneyAmountRules(
|
||||
{
|
||||
value: ["New priceSetMoneyAmountRule"],
|
||||
},
|
||||
{
|
||||
relations: ["price_set_money_amount", "rule_type"],
|
||||
}
|
||||
)
|
||||
|
||||
expect(created).toEqual(
|
||||
expect.objectContaining({
|
||||
|
||||
Reference in New Issue
Block a user