mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 21:23:45 +01:00
Merge pull request #2333 from overleaf/em-unhandled-rejections
Fail tests on unhandled promise rejection GitOrigin-RevId: 3cc53ce5b46c63c62374eb83f9442b8d6979272e
This commit is contained in:
committed by
sharelatex
parent
cfaab43b08
commit
cbf08c599b
+6
@@ -1,3 +1,9 @@
|
||||
const chai = require('chai')
|
||||
chai.use(require('chai-as-promised'))
|
||||
chai.use(require('chaid'))
|
||||
|
||||
// Crash the process on an unhandled promise rejection
|
||||
process.on('unhandledRejection', err => {
|
||||
console.error('Unhandled promise rejection:', err)
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
Vendored
+6
@@ -15,3 +15,9 @@ chai.config.truncateThreshold = 0
|
||||
require('sinon-as-promised')
|
||||
// add support for mongoose in sinon
|
||||
require('sinon-mongoose')
|
||||
|
||||
// Crash the process on an unhandled promise rejection
|
||||
process.on('unhandledRejection', err => {
|
||||
console.error('Unhandled promise rejection:', err)
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
@@ -72,8 +72,8 @@ describe('EmailSender', function() {
|
||||
|
||||
it('should return a non-specific error', async function() {
|
||||
this.sesClient.sendMail.rejects(new Error('boom'))
|
||||
expect(this.EmailSender.promises.sendEmail({})).to.be.rejectedWith(
|
||||
'Error: Cannot send email'
|
||||
await expect(this.EmailSender.promises.sendEmail({})).to.be.rejectedWith(
|
||||
'error sending message'
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
@@ -33,6 +33,12 @@ describe('SAMLIdentityManager', function() {
|
||||
this.institution = {
|
||||
name: 'Overleaf University'
|
||||
}
|
||||
this.InstitutionsAPI = {
|
||||
promises: {
|
||||
addEntitlement: sinon.stub().resolves(),
|
||||
removeEntitlement: sinon.stub().resolves()
|
||||
}
|
||||
}
|
||||
this.SAMLIdentityManager = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'../Email/EmailHandler': (this.EmailHandler = {
|
||||
@@ -59,7 +65,8 @@ describe('SAMLIdentityManager', function() {
|
||||
}),
|
||||
'../User/UserUpdater': (this.UserUpdater = {
|
||||
addEmailAddress: sinon.stub()
|
||||
})
|
||||
}),
|
||||
'../Institutions/InstitutionsAPI': this.InstitutionsAPI
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user