diff --git a/lib/routes/routeBackbeat.js b/lib/routes/routeBackbeat.js index 8f0158e9e7..b9ec83a541 100644 --- a/lib/routes/routeBackbeat.js +++ b/lib/routes/routeBackbeat.js @@ -1310,7 +1310,8 @@ const indexingSchema = joi.array().items(indexEntrySchema).min(1); function respondToRequest(err, response, log, callback) { responseJSONBody(err, null, response, log); - return callback(err); + // The callback is optional, as it is only used for testing purposes + return callback?.(err); } function routeIndexingAPIs(request, response, userInfo, log, callback) { diff --git a/tests/unit/routeBackbeat.js b/tests/unit/routeBackbeat.js index 42e57c6909..8dc881f258 100644 --- a/tests/unit/routeBackbeat.js +++ b/tests/unit/routeBackbeat.js @@ -23,8 +23,6 @@ const testBucket = { namespace, headers: { 'host': `${bucketName}.s3.amazonaws.com`, - // set versioning - }, url: `/${bucketName}`, actionImplicitDenies: false, @@ -47,7 +45,6 @@ describe('routeBackbeat', () => { let response; beforeEach(() => { - // Mock backbeatRoutes sinon.stub(backbeatRoutes, 'PUT').returns({ data: sinon.stub(), metadata: sinon.stub(), @@ -86,7 +83,6 @@ describe('routeBackbeat', () => { index: sinon.stub(), }); - // Mock request and response request = new DummyRequest( { method: 'GET', @@ -131,7 +127,6 @@ describe('routeBackbeat', () => { target: `${bucketName}/${objectName}`, operation: null, versionId: false, - // not sending any body here, so expect error expect: errors.MalformedPOSTRequest, }, {