chore: Treat internal event differently, primarely do not display info logs for those events (#8767)
* chore: Treat internal event differently, primarely do not display info log for those events * revert doc * add few tests * only set internal option if present * revert to previous condition * start including feedback after discussion * include feedback * fix modules integration tests * fix modules integration tests * fix event bus local
This commit is contained in:
+14
-9
@@ -1,10 +1,10 @@
|
||||
import { INotificationModuleService } from "@medusajs/types"
|
||||
import {
|
||||
CommonEvents,
|
||||
composeMessage,
|
||||
Module,
|
||||
Modules,
|
||||
NotificationEvents,
|
||||
composeMessage,
|
||||
} from "@medusajs/utils"
|
||||
import {
|
||||
MockEventBusService,
|
||||
@@ -94,14 +94,19 @@ moduleIntegrationTestRunner({
|
||||
const result = await service.createNotifications(notification)
|
||||
|
||||
expect(eventBusEmitSpy.mock.calls[0][0]).toHaveLength(1)
|
||||
expect(eventBusEmitSpy).toHaveBeenCalledWith([
|
||||
composeMessage(NotificationEvents.NOTIFICATION_CREATED, {
|
||||
data: { id: result.id },
|
||||
object: "notification",
|
||||
source: Modules.NOTIFICATION,
|
||||
action: CommonEvents.CREATED,
|
||||
}),
|
||||
])
|
||||
expect(eventBusEmitSpy).toHaveBeenCalledWith(
|
||||
[
|
||||
composeMessage(NotificationEvents.NOTIFICATION_CREATED, {
|
||||
data: { id: result.id },
|
||||
object: "notification",
|
||||
source: Modules.NOTIFICATION,
|
||||
action: CommonEvents.CREATED,
|
||||
}),
|
||||
],
|
||||
{
|
||||
internal: true,
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
it("ensures the same notification is not sent twice", async () => {
|
||||
|
||||
Reference in New Issue
Block a user