mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #30312 from overleaf/mj-mock-web-api-async
[document-updater] Remove callbacks from MockWebApi GitOrigin-RevId: 0189d5735f3e90160e593fb04043a10b1e922685
This commit is contained in:
committed by
Copybot
parent
ea4dcd4452
commit
82cb0e2839
@@ -147,14 +147,7 @@ describe('Getting a document', function () {
|
||||
|
||||
describe('when the web api returns an error', function () {
|
||||
before(function () {
|
||||
sinon
|
||||
.stub(MockWebApi, 'getDocument')
|
||||
.callsFake((projectId, docId, callback) => {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
callback(new Error('oops'))
|
||||
})
|
||||
sinon.stub(MockWebApi, 'getDocument').rejects(new Error('oops'))
|
||||
})
|
||||
|
||||
after(function () {
|
||||
@@ -173,14 +166,11 @@ describe('Getting a document', function () {
|
||||
describe('when the web api http request takes a long time', function () {
|
||||
before(function (done) {
|
||||
this.timeout = 10000
|
||||
sinon
|
||||
.stub(MockWebApi, 'getDocument')
|
||||
.callsFake((projectId, docId, callback) => {
|
||||
if (callback == null) {
|
||||
callback = function () {}
|
||||
}
|
||||
setTimeout(callback, 30000)
|
||||
sinon.stub(MockWebApi, 'getDocument').returns(
|
||||
new Promise(resolve => {
|
||||
setTimeout(() => resolve(null), 30000)
|
||||
})
|
||||
)
|
||||
done()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user