mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
403c9ae66b
Decaf cleanup GitOrigin-RevId: 9e0770ce6c5362ea288fc1706014aacd45608008
38 lines
1,022 B
JavaScript
38 lines
1,022 B
JavaScript
const sinon = require('sinon')
|
|
const modulePath = '../../../../app/src/Features/User/UserHandler.js'
|
|
const SandboxedModule = require('sandboxed-module')
|
|
|
|
describe('UserHandler', function() {
|
|
beforeEach(function() {
|
|
this.user = {
|
|
_id: '12390i',
|
|
email: 'bob@bob.com',
|
|
remove: sinon.stub().callsArgWith(0)
|
|
}
|
|
|
|
this.TeamInvitesHandler = {
|
|
createTeamInvitesForLegacyInvitedEmail: sinon.stub().yields()
|
|
}
|
|
|
|
this.UserHandler = SandboxedModule.require(modulePath, {
|
|
globals: {
|
|
console: console
|
|
},
|
|
requires: {
|
|
'../Subscription/TeamInvitesHandler': this.TeamInvitesHandler
|
|
}
|
|
})
|
|
})
|
|
|
|
describe('populateTeamInvites', function() {
|
|
beforeEach(function(done) {
|
|
this.UserHandler.populateTeamInvites(this.user, done)
|
|
})
|
|
|
|
it('notifies the user about legacy team invites', function() {
|
|
this.TeamInvitesHandler.createTeamInvitesForLegacyInvitedEmail
|
|
.calledWith(this.user.email)
|
|
.should.eq(true)
|
|
})
|
|
})
|
|
})
|