Add notification types
This commit is contained in:
@@ -30,7 +30,7 @@ describe('Notifications', function () {
|
||||
|
||||
it('can add notifications', async function () {
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const [error, id] = await safe(notifications._add(`title ${i}`, `message ${i}`, { eventId: EVENT_0.id }));
|
||||
const [error, id] = await safe(notifications._add(notifications.ALERT_APP_UPDATED, `title ${i}`, `message ${i}`, { eventId: EVENT_0.id }));
|
||||
expect(error).to.equal(null);
|
||||
expect(id).to.be.a('string');
|
||||
notificationIds.push(id);
|
||||
@@ -42,6 +42,7 @@ describe('Notifications', function () {
|
||||
const [error, result] = await safe(notifications.get(notificationIds[0]));
|
||||
expect(error).to.be(null);
|
||||
expect(result.title).to.be('title 0');
|
||||
expect(result.type).to.be(notifications.ALERT_APP_UPDATED);
|
||||
expect(result.message).to.be('message 0');
|
||||
expect(result.acknowledged).to.be(false);
|
||||
});
|
||||
@@ -60,10 +61,11 @@ describe('Notifications', function () {
|
||||
});
|
||||
|
||||
it('can update notification', async function () {
|
||||
await notifications.update({ id: notificationIds[0] }, { title: 'updated title 0', message: 'updated message 0', acknowledged: true });
|
||||
await notifications.update({ id: notificationIds[0] }, { type: notifications.ALERT_APP_OOM, title: 'updated title 0', message: 'updated message 0', acknowledged: true });
|
||||
|
||||
const result = await notifications.get(notificationIds[0]);
|
||||
expect(result.title).to.be('updated title 0');
|
||||
expect(result.type).to.be(notifications.ALERT_APP_OOM);
|
||||
expect(result.message).to.be('updated message 0');
|
||||
expect(result.acknowledged).to.be(true);
|
||||
});
|
||||
@@ -118,7 +120,7 @@ describe('Notifications', function () {
|
||||
});
|
||||
|
||||
it('can clear the alert', async function () {
|
||||
const id = await notifications.clearAlert(notifications.ALERT_BOX_UPDATE, 'Cloudron xx is available');
|
||||
const id = await notifications.clearAlert(notifications.ALERT_BOX_UPDATE);
|
||||
expect(id).to.be(null);
|
||||
|
||||
const result = await notifications.get(alertId);
|
||||
|
||||
Reference in New Issue
Block a user