Merge pull request #17686 from overleaf/em-promisify-document-manager

Promisify DocumentManager

GitOrigin-RevId: 63a28ef292b5aee708637ebcb53a5cbea7a304e6
This commit is contained in:
Eric Mc Sween
2024-04-03 08:04:13 +00:00
committed by Copybot
parent 3217870c04
commit 6632ffc939
4 changed files with 798 additions and 1237 deletions
@@ -705,12 +705,9 @@ describe('UpdateManager', function () {
describe('lockUpdatesAndDo', function () {
beforeEach(function () {
this.method = sinon
.stub()
.yields(null, this.response_arg1, this.response_arg2)
this.methodResult = 'method result'
this.method = sinon.stub().resolves(this.methodResult)
this.arg1 = 'argument 1'
this.response_arg1 = 'response argument 1'
this.response_arg2 = 'response argument 2'
})
describe('successfully', function () {
@@ -749,10 +746,7 @@ describe('UpdateManager', function () {
})
it('should return the method response arguments', function () {
expect(this.response).to.deep.equal([
this.response_arg1,
this.response_arg2,
])
expect(this.response).to.equal(this.methodResult)
})
it('should release the lock', function () {
@@ -797,7 +791,7 @@ describe('UpdateManager', function () {
this.UpdateManager.promises.processOutstandingUpdates = sinon
.stub()
.resolves()
this.method = sinon.stub().yields(this.error)
this.method = sinon.stub().rejects(this.error)
await expect(
this.UpdateManager.promises.lockUpdatesAndDo(
this.method,