Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('makes es.BadRequest a SavedObjectsClient/BadRequest error', () => {
const error = new esErrors.BadRequest();
expect(isBadRequestError(error)).to.be(false);
expect(decorateEsError(error)).to.be(error);
expect(isBadRequestError(error)).to.be(true);
});
it('should transform elasticsearch errors into boom errors with the same status code', function () {
var conflict = handleESError(new esErrors.Conflict());
expect(conflict.isBoom).to.be(true);
expect(conflict.output.statusCode).to.be(409);
var forbidden = handleESError(new esErrors[403]);
expect(forbidden.isBoom).to.be(true);
expect(forbidden.output.statusCode).to.be(403);
var notFound = handleESError(new esErrors.NotFound());
expect(notFound.isBoom).to.be(true);
expect(notFound.output.statusCode).to.be(404);
var badRequest = handleESError(new esErrors.BadRequest());
expect(badRequest.isBoom).to.be(true);
expect(badRequest.output.statusCode).to.be(400);
});
it('should transform elasticsearch errors into boom errors with the same status code', function () {
const conflict = handleESError(new esErrors.Conflict());
expect(conflict.isBoom).to.be(true);
expect(conflict.output.statusCode).to.be(409);
const forbidden = handleESError(new esErrors[403]);
expect(forbidden.isBoom).to.be(true);
expect(forbidden.output.statusCode).to.be(403);
const notFound = handleESError(new esErrors.NotFound());
expect(notFound.isBoom).to.be(true);
expect(notFound.output.statusCode).to.be(404);
const badRequest = handleESError(new esErrors.BadRequest());
expect(badRequest.isBoom).to.be(true);
expect(badRequest.output.statusCode).to.be(400);
});
it('should transform elasticsearch errors into boom errors with the same status code', function () {
const conflict = handleESError(new esErrors.Conflict());
expect(conflict.isBoom).to.be(true);
expect(conflict.output.statusCode).to.be(409);
const forbidden = handleESError(new esErrors[403]);
expect(forbidden.isBoom).to.be(true);
expect(forbidden.output.statusCode).to.be(403);
const notFound = handleESError(new esErrors.NotFound());
expect(notFound.isBoom).to.be(true);
expect(notFound.output.statusCode).to.be(404);
const badRequest = handleESError(new esErrors.BadRequest());
expect(badRequest.isBoom).to.be(true);
expect(badRequest.output.statusCode).to.be(400);
});