Skip to content

Commit 6b477ac

Browse files
committed
Fixing the test cases
1 parent 56b6d62 commit 6b477ac

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

srv/service.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
const { buildNotification } = require("./../lib/utils")
1+
const { buildNotification, messages } = require("./../lib/utils")
22
const cds = require('@sap/cds')
3+
const LOG = cds.log('notifications');
34

45
class NotificationService extends cds.Service {
56

@@ -9,6 +10,10 @@ class NotificationService extends cds.Service {
910
* @param {object} message - The message object
1011
*/
1112
emit (event, message) {
13+
if(!event) {
14+
LOG._warn && LOG.warn(messages.NO_OBJECT_FOR_NOTIFY);
15+
return;
16+
}
1217
// Outbox calls us with a req object, e.g. { event, data, headers }
1318
if (event.event) return super.emit (event)
1419
// First argument is optional for convenience

0 commit comments

Comments
 (0)