chore: scope campaign identifier index with deleted at (#7821)
This commit is contained in:
+30
-1
@@ -1,9 +1,9 @@
|
||||
import { IPromotionModuleService } from "@medusajs/types"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
import { moduleIntegrationTestRunner } from "medusa-test-utils"
|
||||
import { CampaignBudgetType } from "../../../../../../core/utils/src/promotion/index"
|
||||
import { createCampaigns } from "../../../__fixtures__/campaigns"
|
||||
import { createPromotions } from "../../../__fixtures__/promotion"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
|
||||
jest.setTimeout(30000)
|
||||
|
||||
@@ -170,6 +170,35 @@ moduleIntegrationTestRunner<IPromotionModuleService>({
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it("should create a campaign with a campaign identitifer of a deleted campaign", async () => {
|
||||
const campaign = await service.createCampaigns({
|
||||
name: "test",
|
||||
campaign_identifier: "test",
|
||||
})
|
||||
|
||||
await service.softDeleteCampaigns(campaign.id)
|
||||
|
||||
const recreatedCampaign = await service.createCampaigns({
|
||||
name: "test",
|
||||
campaign_identifier: "test",
|
||||
})
|
||||
|
||||
expect(recreatedCampaign).toEqual(
|
||||
expect.objectContaining({
|
||||
name: "test",
|
||||
campaign_identifier: "test",
|
||||
})
|
||||
)
|
||||
|
||||
const error = await service
|
||||
.restoreCampaigns(campaign.id)
|
||||
.catch((e) => e)
|
||||
|
||||
expect(error.message).toEqual(
|
||||
"Promotion campaign with campaign_identifier: test, already exists."
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe("updateCampaigns", () => {
|
||||
|
||||
Reference in New Issue
Block a user