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-12-19 09:51:18 +00:00
|
|
|
const {active, available} = await models.NotificationSubscription.getList(9);
|
2023-11-08 13:57:07 +00:00
|
|
|
const notifications = await models.Notification.find({});
|
|
|
|
const totalAvailable = notifications.length - active.length;
|
2023-05-09 09:34:32 +00:00
|
|
|
|
2023-12-19 09:51:18 +00:00
|
|
|
expect(active.length).toEqual(2);
|
2023-11-08 13:57:07 +00:00
|
|
|
expect(available.length).toEqual(totalAvailable);
|
2023-05-09 09:34:32 +00:00
|
|
|
});
|
|
|
|
});
|