fix(medusa): Refresh adjustments when region on cart is changed (#1827)

* fix(medusa): Refresh adjustments when region on cart is changed

* fix test

* Fix unit test

* fix: integration tests

* fix: comment
This commit is contained in:
Oliver Windall Juhl
2022-07-11 10:51:55 +02:00
committed by GitHub
parent dffb86bb58
commit 02967f95b1
6 changed files with 7992 additions and 10539 deletions
+19 -1
View File
@@ -57,6 +57,16 @@ module.exports = async (connection, data = {}) => {
await manager.save(r)
const europeRegion = manager.create(Region, {
id: "eur-region",
name: "Europe Region",
payment_providers: [{ id: "test-pay" }],
currency_code: "eur",
tax_rate: 0,
})
await manager.save(europeRegion)
// Region with multiple countries
const regionWithMultipleCoutries = manager.create(Region, {
id: "test-region-multiple",
@@ -141,7 +151,7 @@ module.exports = async (connection, data = {}) => {
ends_at: tenDaysFromToday,
})
tenPercent.regions = [r]
tenPercent.regions = [r, europeRegion]
tenPercent.rule = tenPercentRule
await manager.save(tenPercent)
@@ -533,6 +543,14 @@ module.exports = async (connection, data = {}) => {
})
await manager.save(ma)
const maEur = manager.create(MoneyAmount, {
variant_id: "test-variant",
currency_code: "eur",
type: "default",
amount: 2000,
})
await manager.save(maEur)
const ma_sale = manager.create(MoneyAmount, {
variant_id: "test-variant-sale",
currency_code: "usd",