salix/back/methods/notification/specs/getList.spec.js

13 lines
542 B
JavaScript
Raw Normal View History

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() => {
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
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
});
});