From 7d7e5c9a8f1f061007d02b5ea0bfc6cf7ad5fd0e Mon Sep 17 00:00:00 2001 From: Mathias Jakobsen Date: Fri, 5 Apr 2024 11:57:02 +0100 Subject: [PATCH] Merge pull request #17782 from overleaf/mj-project-history-merge-test-fix [project-history] Fix project history unit test GitOrigin-RevId: 4a8c5c2337ee8a06d46638ceba18d4a0f8742b42 --- .../SnapshotManager/SnapshotManagerTests.js | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/services/project-history/test/unit/js/SnapshotManager/SnapshotManagerTests.js b/services/project-history/test/unit/js/SnapshotManager/SnapshotManagerTests.js index 71cff594dc..4ecd9c759c 100644 --- a/services/project-history/test/unit/js/SnapshotManager/SnapshotManagerTests.js +++ b/services/project-history/test/unit/js/SnapshotManager/SnapshotManagerTests.js @@ -123,18 +123,16 @@ describe('SnapshotManager', function () { describe('of a text file with no tracked changes', function () { beforeEach(function (done) { this.HistoryStoreManager.getBlobStore.withArgs(this.historyId).returns({ - getString: BPromise.promisify( - (this.getString = sinon.stub().yields( - null, - `\ + getString: (this.getString = sinon.stub().resolves( + `\ Hello world One two three Four five six\ `.replace(/^\t/g, '') - )) - ), + )), + getObject: sinon.stub().rejects(), }) this.SnapshotManager.getFileSnapshotStream( this.projectId, @@ -185,7 +183,8 @@ Seven eight nine\ this.HistoryStoreManager.getBlobStore .withArgs(this.historyId) .returns({ - getString: BPromise.promisify(sinon.stub().throws(this.error)), + getString: sinon.stub().rejects(this.error), + getObject: sinon.stub().rejects(this.error), }) }) @@ -503,7 +502,8 @@ Four five six\ beforeEach(function () { this.error = new Error('ESOCKETTIMEDOUT') this.HistoryStoreManager.getBlobStore.withArgs(this.historyId).returns({ - getString: BPromise.promisify(sinon.stub().yields(this.error)), + getString: sinon.stub().rejects(this.error), + getObject: sinon.stub().resolves(), }) }) @@ -571,18 +571,16 @@ Four five six\ }) this.HistoryStoreManager.getBlobStore.withArgs(this.historyId).returns({ - getString: BPromise.promisify( - (this.getString = sinon.stub().yields( - null, - `\ + getString: (this.getString = sinon.stub().resolves( + `\ Hello world One two three Four five six\ `.replace(/^\t/g, '') - )) - ), + )), + getObject: sinon.stub().rejects(), }) this.SnapshotManager.getLatestSnapshot( this.projectId,