mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
notifications: fixes
This commit is contained in:
@@ -90,8 +90,15 @@ describe('response middleware', () => {
|
||||
});
|
||||
|
||||
it('returns notifications if a user is authenticated', () => {
|
||||
res.locals.user.notifications.push({type: 'NEW_CONTRIBUTOR_LEVEL'});
|
||||
let notification = res.locals.user.notifications[0].toJSON();
|
||||
const user = res.locals.user;
|
||||
|
||||
user.notifications = [
|
||||
null, // invalid, not an object
|
||||
{seen: true}, // invalid, no type or id
|
||||
{id: 123}, // invalid, no type
|
||||
// {type: 'ABC'}, // invalid, no id, not included here because the id would be added automatically
|
||||
{type: 'ABC', id: '123'}, // valid
|
||||
];
|
||||
|
||||
responseMiddleware(req, res, next);
|
||||
res.respond(200, {field: 1});
|
||||
@@ -103,8 +110,8 @@ describe('response middleware', () => {
|
||||
data: {field: 1},
|
||||
notifications: [
|
||||
{
|
||||
type: notification.type,
|
||||
id: notification.id,
|
||||
type: 'ABC',
|
||||
id: '123',
|
||||
data: {},
|
||||
seen: false,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user