Fixed regression tests that had to do with new error format

refs #10438
This commit is contained in:
Nazar Gargol 2019-02-25 22:19:51 +07:00
parent d6872de0b2
commit 4d15b25153
4 changed files with 56 additions and 8 deletions

View File

@ -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);
});
});

View File

@ -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'
]);
});
});
});

View File

@ -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();
});
});

View File

@ -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();
});
});