fix: Move default country loading for region to the loader, fix a bug with cascade (#6559)

This commit is contained in:
Stevche Radevski
2024-03-01 14:58:55 +01:00
committed by GitHub
parent 56d97ebef9
commit 347aba719c
16 changed files with 87 additions and 121 deletions

View File

@@ -40,13 +40,13 @@ describe("API Keys - Admin", () => {
beforeEach(async () => {
await createAdminUser(dbConnection, adminHeaders)
// Used for testing cross-module authentication checks
await regionService.createDefaultCountries()
})
afterEach(async () => {
const db = useDb()
// TODO: Once teardown doesn't skip constraint checks and cascades, we can remove this
const existingRegions = await regionService.list({})
await regionService.delete(existingRegions.map((r) => r.id))
await db.teardown()
})

View File

@@ -63,7 +63,6 @@ describe("Carts workflows", () => {
beforeEach(async () => {
await adminSeeder(dbConnection)
await regionModuleService.createDefaultCountries()
// Here, so we don't have to create a region for each test
defaultRegion = await regionModuleService.create({

View File

@@ -59,7 +59,6 @@ describe("Store Carts API", () => {
beforeEach(async () => {
await adminSeeder(dbConnection)
await regionModuleService.createDefaultCountries()
// Here, so we don't have to create a region for each test
defaultRegion = await regionModuleService.create({

View File

@@ -47,11 +47,6 @@ describe("Cart links", () => {
await shutdownServer()
})
beforeEach(async () => {
// @ts-ignore
await regionModule.createDefaultCountries()
})
afterEach(async () => {
const db = useDb()
await db.teardown()

View File

@@ -33,11 +33,6 @@ describe("Link: Cart Region", () => {
await shutdownServer()
})
beforeEach(async () => {
// @ts-ignore
await regionModule.createDefaultCountries()
})
afterEach(async () => {
const db = useDb()
await db.teardown()

View File

@@ -36,12 +36,13 @@ describe("Regions - Admin", () => {
beforeEach(async () => {
await createAdminUser(dbConnection, adminHeaders)
await service.createDefaultCountries()
})
afterEach(async () => {
const db = useDb()
// TODO: Once teardown doesn't skip constraint checks and cascades, we can remove this
const existingRegions = await service.list({})
await service.delete(existingRegions.map((r) => r.id))
await db.teardown()
})

View File

@@ -37,9 +37,6 @@ describe("Store - Admin", () => {
beforeEach(async () => {
await createAdminUser(dbConnection, adminHeaders)
const existingStores = await service.list({})
await service.delete(existingStores.map((s) => s.id))
})
afterEach(async () => {