add back test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Pau 2023-01-18 12:16:47 +01:00
parent 10c70f5388
commit a425d54bf6
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
const app = require('vn-loopback/server/server');
describe('loopback model NotificationSubscription', () => {
it('Should fail to delete a notification if the user is not editing itself or a subordinate', async() => {
const user = 9;
const notificationSubscriptionId = 2;
const ctx = {req: {accessToken: {userId: user}}};
const models = app.models;
const notification = await models.NotificationSubscription.findById(notificationSubscriptionId);
let error;
try {
await models.NotificationSubscription.deleteNotification(ctx, notification.id);
} catch (e) {
error = e;
}
expect(error.message).toContain('You dont have permission to modify this user');
});
});