Skip to content

Commit 5dfc652

Browse files
committed
💚 fix unit tests
Issue: CLDSRV-632
1 parent f07b81a commit 5dfc652

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tests/unit/routes/routeBackbeat.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,18 @@ describe('routeBackbeat', () => {
260260
mockRequest.url = '/_/backbeat/metadata/bucket0/key0' +
261261
'?accountId=123456789012&versionId=aIXVkw5Tw2Pd00000000001I4j3QKsvf';
262262

263-
sandbox.stub(metadata, 'putObjectMD').callsFake((bucketName, objectKey, omVal, options, logParam, cb) => {
263+
const putObjectMDStub = sandbox.stub(metadata, 'putObjectMD');
264+
putObjectMDStub.onCall(0).callsFake((bucketName, objectKey, omVal, options, logParam, cb) => {
265+
assert.strictEqual(options.repairMaster, undefined);
266+
cb(null, {});
267+
});
268+
putObjectMDStub.onCall(1).callsFake((bucketName, objectKey, omVal, options, logParam, cb) => {
264269
assert.strictEqual(options.repairMaster, true);
265270
cb(null, {});
266271
});
267272

268-
// Override default callback to return undefined for objMd to simulate new version
269-
metadataUtils.standardMetadataValidateBucketAndObj.callsFake((params, denies, log, callback) => {
270-
callback(null, bucketInfo, undefined);
273+
metadataUtils.standardMetadataValidateBucketAndObj.onCall(1).callsFake((params, denies, log, callback) => {
274+
callback(null, bucketInfo, {});
271275
});
272276

273277
routeBackbeat('127.0.0.1', mockRequest, mockResponse, log);

0 commit comments

Comments
 (0)