Skip to content

Commit

Permalink
fix: failing test from d1959a2
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlam committed Jul 21, 2021
1 parent d1959a2 commit f71f295
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions test/controllers-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,13 @@ describe('Admin Controllers', () => {
it('should error with no privileges', (done) => {
request(`${nconf.get('url')}/api/flags`, { json: true }, (err, res, body) => {
assert.ifError(err);
assert.equal(body.error, '[[error:no-privileges]]');
assert.deepStrictEqual(body, {
status: {
code: 'not-authorised',
message: 'A valid login session was not found. Please log in and try again.',
},
response: {},
});
done();
});
});
Expand All @@ -631,10 +637,20 @@ describe('Admin Controllers', () => {
});
});

it('should return invalid data if flag does not exist', (done) => {
request(`${nconf.get('url')}/api/flags/123123123`, { jar: moderatorJar, json: true }, (err, res, body) => {
it('should return a 404 if flag does not exist', (done) => {
request(`${nconf.get('url')}/api/flags/123123123`, {
jar: moderatorJar,
json: true,
headers: {
Accept: 'text/html, application/json',
},
}, (err, res, body) => {
assert.ifError(err);
assert.equal(body.error, '[[error:invalid-data]]');
assert.deepStrictEqual(body, {
path: '/flags/123123123',
title: '[[global:404.title]]',
bodyClass: 'page-flags page-flags-123123123 page-status-404',
});
done();
});
});
Expand Down

0 comments on commit f71f295

Please sign in to comment.