chore(integration-tests): Flaky tests (#3126)

This commit is contained in:
Adrien de Peretti
2023-01-27 17:45:54 +01:00
committed by GitHub
parent 4f0d8992a0
commit e581d3bd90
6 changed files with 49 additions and 19 deletions
+4 -1
View File
@@ -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,