mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
[server-pro] tests: make project invite tests more reliable (#23732)
* [web] wait for sending project invite notification, send email detached Errors from sending the notification or email are still logged only. Wait up-to ~one second for notification to be sent (API timeout is 1s). * [server-pro] tests: wait for invite action to complete GitOrigin-RevId: e6998e6134b5267c91b47785d616a46e9651b996
This commit is contained in:
@@ -73,12 +73,18 @@ describe('CollaboratorsInviteHandler', function () {
|
||||
},
|
||||
addEntryInBackground: sinon.stub(),
|
||||
}
|
||||
this.logger = {
|
||||
debug: sinon.stub(),
|
||||
warn: sinon.stub(),
|
||||
err: sinon.stub(),
|
||||
}
|
||||
|
||||
this.CollaboratorsInviteHandler = await esmock.strict(MODULE_PATH, {
|
||||
'@overleaf/settings': this.settings,
|
||||
'../../../../app/src/models/ProjectInvite.js': {
|
||||
ProjectInvite: this.ProjectInvite,
|
||||
},
|
||||
'@overleaf/logger': this.logger,
|
||||
'../../../../app/src/Features/Collaborators/CollaboratorsEmailHandler.mjs':
|
||||
this.CollaboratorsEmailHandler,
|
||||
'../../../../app/src/Features/Collaborators/CollaboratorsHandler.js':
|
||||
@@ -244,15 +250,9 @@ describe('CollaboratorsInviteHandler', function () {
|
||||
sinon.stub().rejects(new Error('woops'))
|
||||
})
|
||||
|
||||
it('should produce an error', async function () {
|
||||
await expect(this.call()).to.be.rejectedWith(Error)
|
||||
})
|
||||
|
||||
it('should not call _trySendInviteNotification', async function () {
|
||||
await expect(this.call()).to.be.rejected
|
||||
this.CollaboratorsInviteHandler.promises._trySendInviteNotification.callCount.should.equal(
|
||||
0
|
||||
)
|
||||
it('should not produce an error', async function () {
|
||||
await expect(this.call()).to.be.fulfilled
|
||||
expect(this.logger.err).to.be.calledOnce
|
||||
})
|
||||
})
|
||||
|
||||
@@ -262,8 +262,9 @@ describe('CollaboratorsInviteHandler', function () {
|
||||
sinon.stub().rejects(new Error('woops'))
|
||||
})
|
||||
|
||||
it('should produce an error', async function () {
|
||||
await expect(this.call()).to.be.rejectedWith(Error)
|
||||
it('should not produce an error', async function () {
|
||||
await expect(this.call()).to.be.fulfilled
|
||||
expect(this.logger.err).to.be.calledOnce
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user