feat: Add support for sendgrid and logger notification providers (#7290)
* feat: Add support for sendgrid and logger notification providers * fix: changes based on PR review
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
import { LocalNotificationService } from "../../src/services/local"
|
||||
jest.setTimeout(100000)
|
||||
|
||||
describe("Local notification provider", () => {
|
||||
let localService: LocalNotificationService
|
||||
|
||||
beforeAll(() => {
|
||||
localService = new LocalNotificationService(
|
||||
{
|
||||
logger: console as any,
|
||||
},
|
||||
{}
|
||||
)
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks()
|
||||
})
|
||||
|
||||
it("sends logs to the console output with the notification details", async () => {
|
||||
const logSpy = jest.spyOn(console, "info")
|
||||
await localService.send({
|
||||
to: "test@medusajs.com",
|
||||
channel: "email",
|
||||
template: "some-template",
|
||||
data: {
|
||||
username: "john-doe",
|
||||
},
|
||||
})
|
||||
|
||||
expect(logSpy).toHaveBeenCalled()
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
'Attempting to send a notification to: test@medusajs.com on the channel: email with template: some-template and data: {"username":"john-doe"}'
|
||||
)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user