From 4d15b25153735f48f3acb9686b4d38334d6207b4 Mon Sep 17 00:00:00 2001 From: Nazar Gargol Date: Mon, 25 Feb 2019 22:19:51 +0700 Subject: [PATCH] Fixed regression tests that had to do with new error format refs #10438 --- core/test/regression/api/v2/admin/db_spec.js | 4 ++-- .../regression/api/v2/admin/posts_spec.js | 20 +++++++++++++++++-- .../regression/api/v2/admin/settings_spec.js | 20 +++++++++++++++++-- .../regression/api/v2/admin/users_spec.js | 20 +++++++++++++++++-- 4 files changed, 56 insertions(+), 8 deletions(-) diff --git a/core/test/regression/api/v2/admin/db_spec.js b/core/test/regression/api/v2/admin/db_spec.js index 21ac75257f..3f5ee25aa0 100644 --- a/core/test/regression/api/v2/admin/db_spec.js +++ b/core/test/regression/api/v2/admin/db_spec.js @@ -104,7 +104,7 @@ describe('DB API', () => { .expect(403) .then(res => { should.exist(res.body.errors); - res.body.errors[0].errorType.should.eql('NoPermissionError'); + res.body.errors[0].type.should.eql('NoPermissionError'); fsStub.called.should.eql(false); }); }); @@ -118,7 +118,7 @@ describe('DB API', () => { .expect(401) .then(res => { should.exist(res.body.errors); - res.body.errors[0].errorType.should.eql('UnauthorizedError'); + res.body.errors[0].type.should.eql('UnauthorizedError'); fsStub.called.should.eql(false); }); }); diff --git a/core/test/regression/api/v2/admin/posts_spec.js b/core/test/regression/api/v2/admin/posts_spec.js index a578f5ba15..3ba7d25284 100644 --- a/core/test/regression/api/v2/admin/posts_spec.js +++ b/core/test/regression/api/v2/admin/posts_spec.js @@ -108,7 +108,15 @@ describe('Posts API', function () { var jsonResponse = res.body; should.exist(jsonResponse); should.exist(jsonResponse.errors); - testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']); + testUtils.API.checkResponseValue(jsonResponse.errors[0], [ + 'message', + 'context', + 'type', + 'details', + 'help', + 'code', + 'id' + ]); done(); }); }); @@ -190,7 +198,15 @@ describe('Posts API', function () { should.not.exist(res.headers['x-cache-invalidate']); should.exist(res.body); should.exist(res.body.errors); - testUtils.API.checkResponseValue(res.body.errors[0], ['message', 'errorType']); + testUtils.API.checkResponseValue(res.body.errors[0], [ + 'message', + 'context', + 'type', + 'details', + 'help', + 'code', + 'id' + ]); }); }); }); diff --git a/core/test/regression/api/v2/admin/settings_spec.js b/core/test/regression/api/v2/admin/settings_spec.js index cb411916e5..d5d3dab82a 100644 --- a/core/test/regression/api/v2/admin/settings_spec.js +++ b/core/test/regression/api/v2/admin/settings_spec.js @@ -64,7 +64,15 @@ describe('Settings API', function () { var jsonResponse = res.body; should.exist(jsonResponse); should.exist(jsonResponse.errors); - testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']); + testUtils.API.checkResponseValue(jsonResponse.errors[0], [ + 'message', + 'context', + 'type', + 'details', + 'help', + 'code', + 'id' + ]); done(); }); }); @@ -120,7 +128,15 @@ describe('Settings API', function () { jsonResponse = res.body; should.not.exist(res.headers['x-cache-invalidate']); should.exist(jsonResponse.errors); - testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']); + testUtils.API.checkResponseValue(jsonResponse.errors[0], [ + 'message', + 'context', + 'type', + 'details', + 'help', + 'code', + 'id' + ]); done(); }); }); diff --git a/core/test/regression/api/v2/admin/users_spec.js b/core/test/regression/api/v2/admin/users_spec.js index b0828df060..49e88ee624 100644 --- a/core/test/regression/api/v2/admin/users_spec.js +++ b/core/test/regression/api/v2/admin/users_spec.js @@ -58,7 +58,15 @@ describe('User API', function () { var jsonResponse = res.body; should.exist(jsonResponse); should.exist(jsonResponse.errors); - testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']); + testUtils.API.checkResponseValue(jsonResponse.errors[0], [ + 'message', + 'context', + 'type', + 'details', + 'help', + 'code', + 'id' + ]); done(); }); }); @@ -79,7 +87,15 @@ describe('User API', function () { var jsonResponse = res.body; should.exist(jsonResponse); should.exist(jsonResponse.errors); - testUtils.API.checkResponseValue(jsonResponse.errors[0], ['message', 'errorType']); + testUtils.API.checkResponseValue(jsonResponse.errors[0], [ + 'message', + 'context', + 'type', + 'details', + 'help', + 'code', + 'id' + ]); done(); }); });