chore(integration-tests): Flaky tests (#3126)
This commit is contained in:
@@ -169,7 +169,10 @@ export class ProductRepository extends Repository<Product> {
|
||||
"variants.deleted_at IS NULL"
|
||||
)
|
||||
|
||||
order["variants.variant_rank"] = "ASC"
|
||||
if (!Object.keys(order).some((key) => key.startsWith("variants"))) {
|
||||
// variant_rank being select false, apply the filter here directly
|
||||
querybuilder.addOrderBy(`${toplevel}.variant_rank`, "ASC")
|
||||
}
|
||||
} else {
|
||||
querybuilder = querybuilder.leftJoinAndSelect(
|
||||
`products.${toplevel}`,
|
||||
|
||||
@@ -650,6 +650,9 @@ describe("ProductVariantService", () => {
|
||||
.mockImplementation(() => Promise.resolve())
|
||||
|
||||
const regionService = {
|
||||
withTransaction: function () {
|
||||
return this
|
||||
},
|
||||
list: jest.fn().mockImplementation((config) => {
|
||||
const idOrIds = config.id
|
||||
|
||||
|
||||
@@ -347,9 +347,11 @@ class ProductVariantService extends TransactionBaseService {
|
||||
prices
|
||||
)
|
||||
|
||||
const regionsServiceTx = this.regionService_.withTransaction(manager)
|
||||
|
||||
for (const price of prices) {
|
||||
if (price.region_id) {
|
||||
const region = await this.regionService_.retrieve(price.region_id)
|
||||
const region = await regionsServiceTx.retrieve(price.region_id)
|
||||
|
||||
await this.setRegionPrice(variantId, {
|
||||
currency_code: region.currency_code,
|
||||
|
||||
Reference in New Issue
Block a user