feat(notification): Handle long running transaction and add status support (#8900)

RESOLVES FRMW-2110
RESOLVES FRMW-2095

**What**
- Fix notification module to not retain transactions open while sending notification
- Add support for notification status [success, pending, failure]
This commit is contained in:
Adrien de Peretti
2024-09-01 08:01:47 +00:00
committed by GitHub
parent dbb10ff051
commit 99461e24ab
11 changed files with 265 additions and 62 deletions
@@ -8,7 +8,7 @@ import {
ContainerRegistrationKeys,
ModuleRegistrationName,
} from "@medusajs/utils"
import { TestEventUtils, medusaIntegrationTestRunner } from "medusa-test-utils"
import { medusaIntegrationTestRunner, TestEventUtils } from "medusa-test-utils"
jest.setTimeout(50000)
@@ -91,14 +91,18 @@ medusaIntegrationTestRunner({
it("should throw an exception if there is no provider for the channel", async () => {
const notification = {
to: "test@medusajs.com",
template: "order-created",
channel: "sms",
} as CreateNotificationDTO
const error = await service
.createNotifications(notification)
.catch((e) => e)
const [notificationResult] = await service.listNotifications()
expect(error.message).toEqual(
"Could not find a notification provider for channel: sms"
`Could not find a notification provider for channel: sms for notification id ${notificationResult.id}`
)
})