fix: Remove undefined from events in update (#10170)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { IRegionModuleService } from "@medusajs/framework/types"
|
||||
import { Module, Modules } from "@medusajs/framework/utils"
|
||||
import { RegionModuleService } from "@services"
|
||||
import { moduleIntegrationTestRunner } from "@medusajs/test-utils"
|
||||
import { RegionModuleService } from "@services"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
@@ -403,6 +403,32 @@ moduleIntegrationTestRunner<IRegionModuleService>({
|
||||
expect(resp.countries).toHaveLength(2)
|
||||
})
|
||||
|
||||
it("should delete a region without countries", async () => {
|
||||
const createdRegion = await service.createRegions({
|
||||
name: "North America",
|
||||
currency_code: "USD",
|
||||
countries: [],
|
||||
})
|
||||
|
||||
await service.softDeleteRegions([createdRegion.id])
|
||||
|
||||
const [deletedRegion] = await service.listRegions(
|
||||
{ id: createdRegion.id },
|
||||
{ withDeleted: true }
|
||||
)
|
||||
|
||||
expect(deletedRegion).toEqual({
|
||||
id: createdRegion.id,
|
||||
name: createdRegion.name,
|
||||
currency_code: createdRegion.currency_code,
|
||||
metadata: null,
|
||||
automatic_taxes: createdRegion.automatic_taxes,
|
||||
created_at: expect.any(Date),
|
||||
updated_at: expect.any(Date),
|
||||
deleted_at: expect.any(Date),
|
||||
})
|
||||
})
|
||||
|
||||
it("should unset the region ID on the country when soft deleting a region", async () => {
|
||||
const createdRegion = await service.createRegions({
|
||||
name: "North America",
|
||||
|
||||
Reference in New Issue
Block a user