From e9204c9168062b63015dc50605870f8bf182a356 Mon Sep 17 00:00:00 2001 From: Nazar Gargol Date: Wed, 16 Sep 2020 14:24:20 +1200 Subject: [PATCH] Updated invitations test coverage with more specific checks refs https://github.com/TryGhost/Ghost/issues/11878 - Updated test cases in preparation to improve messaging in referenced issue. --- test/regression/api/canary/admin/authentication_spec.js | 7 ++++++- test/regression/api/v2/admin/authentication_spec.js | 7 ++++++- test/regression/api/v3/admin/authentication_spec.js | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/test/regression/api/canary/admin/authentication_spec.js b/test/regression/api/canary/admin/authentication_spec.js index f816bdf426..c6b12526c4 100644 --- a/test/regression/api/canary/admin/authentication_spec.js +++ b/test/regression/api/canary/admin/authentication_spec.js @@ -301,7 +301,12 @@ describe('Authentication API v3', function () { }) .expect('Content-Type', /json/) .expect('Cache-Control', testUtils.cacheRules.private) - .expect(401); + .expect(401) + .then((res) => { + should.exist(res.body.errors); + res.body.errors[0].type.should.eql('UnauthorizedError'); + res.body.errors[0].message.should.eql('Invalid token structure'); + }); }); it('reset password: generate reset token', function () { diff --git a/test/regression/api/v2/admin/authentication_spec.js b/test/regression/api/v2/admin/authentication_spec.js index 7163776eda..2d6c15c4f9 100644 --- a/test/regression/api/v2/admin/authentication_spec.js +++ b/test/regression/api/v2/admin/authentication_spec.js @@ -409,7 +409,12 @@ describe('Authentication API v2', function () { }) .expect('Content-Type', /json/) .expect('Cache-Control', testUtils.cacheRules.private) - .expect(401); + .expect(401) + .then((res) => { + should.exist(res.body.errors); + res.body.errors[0].type.should.eql('UnauthorizedError'); + res.body.errors[0].message.should.eql('Invalid token structure'); + }); }); it('reset password: generate reset token', function () { diff --git a/test/regression/api/v3/admin/authentication_spec.js b/test/regression/api/v3/admin/authentication_spec.js index 410fa2718d..7a7c025dc7 100644 --- a/test/regression/api/v3/admin/authentication_spec.js +++ b/test/regression/api/v3/admin/authentication_spec.js @@ -285,7 +285,12 @@ describe('Authentication API v3', function () { }) .expect('Content-Type', /json/) .expect('Cache-Control', testUtils.cacheRules.private) - .expect(401); + .expect(401) + .then((res) => { + should.exist(res.body.errors); + res.body.errors[0].type.should.eql('UnauthorizedError'); + res.body.errors[0].message.should.eql('Invalid token structure'); + }); }); it('reset password: generate reset token', function () {