From cf87daa754604d9339575df58ac73ff77ab1cb8a Mon Sep 17 00:00:00 2001 From: Tim Alby Date: Tue, 28 Apr 2020 12:17:53 +0200 Subject: [PATCH] fix Metrics module stub --- .../js/DispatchManager/DispatchManagerTests.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/services/document-updater/test/unit/js/DispatchManager/DispatchManagerTests.js b/services/document-updater/test/unit/js/DispatchManager/DispatchManagerTests.js index 48eb2fbb92..a177f162fb 100644 --- a/services/document-updater/test/unit/js/DispatchManager/DispatchManagerTests.js +++ b/services/document-updater/test/unit/js/DispatchManager/DispatchManagerTests.js @@ -20,6 +20,7 @@ const Errors = require('../../../../app/js/Errors.js') describe('DispatchManager', function () { beforeEach(function () { + let Timer this.timeout(3000) this.DispatchManager = SandboxedModule.require(modulePath, { requires: { @@ -37,11 +38,17 @@ describe('DispatchManager', function () { 'redis-sharelatex': (this.redis = {}), './RateLimitManager': {}, './Errors': Errors, - './Metrics': { - Timer() { - return { done() {} } - } - } + './Metrics': (this.Metrics = { + Timer: (Timer = (function () { + Timer = class Timer { + static initClass() { + this.prototype.done = sinon.stub() + } + } + Timer.initClass() + return Timer + })()) + }) } }) this.callback = sinon.stub()