feat: Set withDeleted as true if filtering on deleted_at in modules (#6626)

Similar convention already existed in v1, so we are just applying this for the abstract module factory
This commit is contained in:
Stevche Radevski authored and GitHub committed 2024-03-08 11:40:00 +00:00
1 parent 272fb6d328
commit 056e3e9599
4 files changed
+67 -6

No files matched your search

@@ -765,6 +765,23 @@ describe("ProductModuleService products", function () {
}
})
it("should retrieve soft-deleted products if filtered on deleted_at", async () => {
const data = buildProductAndRelationsData({
images,
thumbnail: images[0],
})
const products = await module.create([data])
await module.softDelete([products[0].id])
const softDeleted = await module.list({
deleted_at: { $gt: "01-01-2022" },
})
expect(softDeleted).toHaveLength(1)
})
it("should emit events through eventBus", async () => {
const eventBusSpy = jest.spyOn(EventBusService.prototype, "emit")
const data = buildProductAndRelationsData({