feat: Development server for core + plugins (#2448)
This commit is contained in:
committed by
GitHub
parent
4de4f20b46
commit
b88cef2b1f
45
integration-tests/development/database/region.js
Normal file
45
integration-tests/development/database/region.js
Normal file
@@ -0,0 +1,45 @@
|
||||
const { Region } = require("@medusajs/medusa")
|
||||
|
||||
module.exports = async (connection) => {
|
||||
const manager = connection.manager
|
||||
|
||||
const r = manager.create(Region, {
|
||||
id: "test-region",
|
||||
name: "Test Region",
|
||||
payment_providers: [{ id: "test-pay" }],
|
||||
currency_code: "usd",
|
||||
tax_rate: 0,
|
||||
})
|
||||
|
||||
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",
|
||||
name: "Test Region",
|
||||
currency_code: "eur",
|
||||
tax_rate: 0,
|
||||
})
|
||||
|
||||
await manager.save(regionWithMultipleCoutries)
|
||||
|
||||
await manager.query(
|
||||
`UPDATE "country" SET region_id='test-region-multiple' WHERE iso_2 = 'no'`
|
||||
)
|
||||
await manager.query(
|
||||
`UPDATE "country" SET region_id='test-region-multiple' WHERE iso_2 = 'dk'`
|
||||
)
|
||||
await manager.query(
|
||||
`UPDATE "country" SET region_id='test-region' WHERE iso_2 = 'us'`
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user