2023-05-09 09:34:32 +00:00
|
|
|
const models = require('vn-loopback/server/server').models;
|
|
|
|
|
|
|
|
describe('NotificationSubscription getList()', () => {
|
|
|
|
it('should return a list of available and active notifications of a user', async() => {
|
2023-11-08 13:57:07 +00:00
|
|
|
const userId = 9;
|
|
|
|
const {active, available} = await models.NotificationSubscription.getList(userId);
|
|
|
|
const notifications = await models.Notification.find({});
|
|
|
|
const totalAvailable = notifications.length - active.length;
|
2023-05-09 09:34:32 +00:00
|
|
|
|
2023-11-08 13:57:07 +00:00
|
|
|
expect(active.length).toEqual(2);
|
|
|
|
expect(available.length).toEqual(totalAvailable);
|
2023-05-09 09:34:32 +00:00
|
|
|
});
|
|
|
|
});
|