feat: allow html content for notifications (#9613)

* feat: allow passing provider specific metadata to notification module

* changed providerContext to snake cased

* rename provider_context to content
This commit is contained in:
Christian
2024-10-18 11:36:22 +02:00
committed by GitHub
parent 2a98be6b65
commit a0b747e117
7 changed files with 121 additions and 2 deletions
@@ -85,6 +85,30 @@ moduleIntegrationTestRunner<INotificationModuleService>({
)
})
it("should send a notification and don't store the content in the database", async () => {
const notification = {
to: "admin@medusa.com",
template: "signup-template",
channel: "email",
data: {},
content: {
html: "<p>Welcome to medusa</p>",
},
}
const result = await service.createNotifications(notification)
const dbEntry = await service.retrieveNotification(result.id)
expect(dbEntry).toEqual(
expect.objectContaining({
provider_id: "test-provider",
external_id: "external_id",
status: NotificationStatus.SUCCESS,
})
)
expect(dbEntry).not.toHaveProperty("content")
})
it("should emit an event when a notification is created", async () => {
const notification = {
to: "admin@medusa.com",