Skip to content

Commit 582f9e2

Browse files
committed
fix some small issues
1 parent f8fd7a4 commit 582f9e2

File tree

4 files changed

+6
-22
lines changed

4 files changed

+6
-22
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ alert.notify({
4646
});
4747
```
4848

49+
* **priority** - Priority of the notification, this argument is optional, it defaults to NEUTRAL
50+
* **description** - Subtitle for the notification, this argument is optional
51+
4952
## Use Notification Types
5053

5154
### 1. Add notification types
@@ -102,7 +105,7 @@ In local environment, when you publish notification, it is mocked to publish the
102105

103106
#### Notification Destination
104107

105-
As a pre-requisite to publish the notification, you need to have a [destination](https://help.sap.com/docs/build-work-zone-standard-edition/sap-build-work-zone-standard-edition/enabling-notifications-for-custom-apps-on-sap-btp-cloud-foundry#configure-the-destination-to-the-notifications-service) configured to publish the notification. In the `package.json` by default destination name `SAP_Notification` is added, you can modify the destination name that you are configuring.
108+
As a pre-requisite to publish the notification, you need to have a [destination](https://help.sap.com/docs/build-work-zone-standard-edition/sap-build-work-zone-standard-edition/enabling-notifications-for-custom-apps-on-sap-btp-cloud-foundry#configure-the-destination-to-the-notifications-service) configured to publish the notification. In the `package.json` by default destination name `SAP_Notifications` is added, you can modify the destination name that you are configuring.
106109

107110
#### Integrate with SAP Build Work Zone
108111

@@ -128,12 +131,12 @@ You can use these two signature to send the custom notification with pre-defined
128131

129132
#### With pre-defined parameters
130133

131-
By using this approach you can post a notification by providing different parts of the notification object grouped in related units
134+
By using this approach you can send notifications with the predefined parameters - recipients, data, priority, type and other parameters listed in the [API documentation](https://help.sap.com/docs/build-work-zone-standard-edition/sap-build-work-zone-standard-edition/developing-cloud-foundry-applications-with-notifications)
132135

133136
```js
134137
alert.notify({
135138
recipients: [...supporters()],
136-
type: "IncidentResolved"
139+
type: "IncidentResolved",
137140
priority: 'NEUTRAL',
138141
data: {
139142
customer: customer.info,

test/lib/content-deployment.test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ describe("contentDeployment", () => {
2626

2727
console.log(setGlobalLogLevel.mock.calls);
2828
assert.expect(setGlobalLogLevel.mock.calls[0][0]).to.be.equal("error");
29-
// NOTE: disabling this test, as it fails after we added default configuration in
30-
// And I think it is not necessary to test this, maybe even wrong
31-
// assert.expect(readFile.mock.calls[0][0]).to.be.equal('');
3229
assert.expect(validateNotificationTypes.mock.calls[0][0]).to.be.deep.equal([]);
3330
assert.expect(processNotificationTypes.mock.calls[0][0]).to.be.deep.equal([]);
3431
});
@@ -43,8 +40,6 @@ describe("contentDeployment", () => {
4340

4441
console.log(setGlobalLogLevel.mock.calls);
4542
assert.expect(setGlobalLogLevel.mock.calls[0][0]).to.be.equal("error");
46-
// As above:
47-
// assert.expect(readFile.mock.calls[0][0]).to.be.equal('');
4843
assert.expect(validateNotificationTypes.mock.calls[0][0]).to.be.deep.equal([]);
4944
assert.expect(processNotificationTypes.mock.calls[0]).to.be.deep.equal(undefined);
5045
});

test/lib/utils.test.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -539,18 +539,6 @@ describe("Test utils", () => {
539539
).toBeFalsy();
540540
});
541541

542-
// .payload not used anymore
543-
// test("When invalid payload for custom notification is passed to buildNotification", () => {
544-
// expect(
545-
// buildNotification({
546-
// recipients: ["[email protected]"],
547-
// type: "TestNotificationType",
548-
// priority: "NEUTRAL",
549-
// payload: "invalid"
550-
// })
551-
// ).toBeFalsy();
552-
// });
553-
554542
test("Given invalid NTypes | When validateNotificationTypes is called | Then false is returned", () => {
555543
expect(validateNotificationTypes([{ NotificationTypeKey: "Test" }, { blabla: "Test2" }])).toEqual(false);
556544
});

test/srv/notifyToRest.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const { messages, buildNotification } = require("../../lib/utils");
22
const NotifyToRest = require("../../srv/notifyToRest");
33

4-
// jest.mock("../../srv/notifyToRest");
5-
64
describe("notify to rest", () => {
75
it("when no object is passed", async () => {
86
const notifyToRest = new NotifyToRest();

0 commit comments

Comments
 (0)