notifications: rename ALERT_ to TYPE_
This commit is contained in:
@@ -26,11 +26,11 @@ describe('Notifications', function () {
|
||||
before(setup);
|
||||
after(cleanup);
|
||||
|
||||
let notificationIds = [];
|
||||
const notificationIds = [];
|
||||
|
||||
it('can add notifications', async function () {
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const [error, id] = await safe(notifications._add(notifications.ALERT_APP_UPDATED, `title ${i}`, `message ${i}`, { eventId: EVENT_0.id }));
|
||||
const [error, id] = await safe(notifications._add(notifications.TYPE_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,7 +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.type).to.be(notifications.TYPE_APP_UPDATED);
|
||||
expect(result.message).to.be('message 0');
|
||||
expect(result.acknowledged).to.be(false);
|
||||
});
|
||||
@@ -61,11 +61,11 @@ describe('Notifications', function () {
|
||||
});
|
||||
|
||||
it('can update notification', async function () {
|
||||
await notifications.update({ id: notificationIds[0] }, { type: notifications.ALERT_APP_OOM, title: 'updated title 0', message: 'updated message 0', acknowledged: true });
|
||||
await notifications.update({ id: notificationIds[0] }, { type: notifications.TYPE_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.type).to.be(notifications.TYPE_APP_OOM);
|
||||
expect(result.message).to.be('updated message 0');
|
||||
expect(result.acknowledged).to.be(true);
|
||||
});
|
||||
@@ -87,7 +87,7 @@ describe('Notifications', function () {
|
||||
|
||||
let alertId;
|
||||
it('can add alert', async function () {
|
||||
alertId = await notifications.alert(notifications.ALERT_BOX_UPDATE, 'Cloudron xx is available', 'Awesome changelog', { persist: true });
|
||||
alertId = await notifications.alert(notifications.TYPE_BOX_UPDATE, 'Cloudron xx is available', 'Awesome changelog', { persist: true });
|
||||
|
||||
const result = await notifications.get(alertId);
|
||||
expect(result.title).to.be('Cloudron xx is available');
|
||||
@@ -98,7 +98,7 @@ describe('Notifications', function () {
|
||||
it('can update the alert (persist)', async function () {
|
||||
await notifications.update({ id: alertId }, { acknowledged: true }); // ack the alert
|
||||
|
||||
const id = await notifications.alert(notifications.ALERT_BOX_UPDATE, 'Cloudron xx is available', 'Awesome new changelog', { persist: true });
|
||||
const id = await notifications.alert(notifications.TYPE_BOX_UPDATE, 'Cloudron xx is available', 'Awesome new changelog', { persist: true });
|
||||
expect(id).to.be(alertId);
|
||||
|
||||
const result = await notifications.get(alertId);
|
||||
@@ -110,7 +110,7 @@ describe('Notifications', function () {
|
||||
it('can update the alert (non-persist)', async function () {
|
||||
await notifications.update({ id: alertId }, { acknowledged: true }); // ack the alert
|
||||
|
||||
const id = await notifications.alert(notifications.ALERT_BOX_UPDATE, 'Cloudron xx is available', 'Awesome new changelog', { persist: false });
|
||||
const id = await notifications.alert(notifications.TYPE_BOX_UPDATE, 'Cloudron xx is available', 'Awesome new changelog', { persist: false });
|
||||
expect(id).to.be(alertId);
|
||||
|
||||
const result = await notifications.get(alertId);
|
||||
@@ -120,7 +120,7 @@ describe('Notifications', function () {
|
||||
});
|
||||
|
||||
it('can clear the alert', async function () {
|
||||
const id = await notifications.clearAlert(notifications.ALERT_BOX_UPDATE);
|
||||
const id = await notifications.clearAlert(notifications.TYPE_BOX_UPDATE);
|
||||
expect(id).to.be(null);
|
||||
|
||||
const result = await notifications.get(alertId);
|
||||
|
||||
Reference in New Issue
Block a user