From f71f29510d2ba9a41544573ffc00dd77b627e09a Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 21 Jul 2021 17:06:08 -0400 Subject: [PATCH] fix: failing test from d1959a2 --- test/controllers-admin.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/test/controllers-admin.js b/test/controllers-admin.js index ba9f27be23..8f590d0f92 100644 --- a/test/controllers-admin.js +++ b/test/controllers-admin.js @@ -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(); }); }); @@ -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(); }); });