Skip to content

Commit

Permalink
Split the test
Browse files Browse the repository at this point in the history
It was not testing both cases, but only one

Issue: ARSN-448
  • Loading branch information
williamlardier committed Nov 29, 2024
1 parent b22150a commit 0421e54
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/unit/s3routes/routeDELETE.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('routeDELETE', () => {
);
});

it('should return 204 when objectDelete encounters NoSuchKey or NoSuchVersion errors', () => {
it('should return 204 when objectDelete encounters NoSuchKey errors', () => {
request.objectKey = 'objectKey';
request.query = {};

Expand All @@ -107,6 +107,22 @@ describe('routeDELETE', () => {
);
});

it('should return 204 when objectDelete encounters NoSuchVersion errors', () => {
request.objectKey = 'objectKey';
request.query = {};

const noSuchVersionError = new ArsenalError('NoSuchVersion');
api.callApiMethod = jest.fn((method, req, res, log, callback) => {
callback(noSuchVersionError, {});
});

routeDELETE(request, response, api, log, statsClient);

expect(routesUtils.responseNoBody).toHaveBeenCalledWith(
null, {}, response, 204, log,
);
});

it('should return error code when objectDelete encounters non-arsenal errors', () => {
request.objectKey = 'objectKey';
request.query = {};
Expand Down

0 comments on commit 0421e54

Please sign in to comment.