2019-05-29 05:21:06 -04:00
|
|
|
const sinon = require('sinon')
|
|
|
|
const modulePath = '../../../../app/src/Features/User/UserHandler.js'
|
|
|
|
const SandboxedModule = require('sandboxed-module')
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
describe('UserHandler', function () {
|
|
|
|
beforeEach(function () {
|
2019-05-29 05:21:06 -04:00
|
|
|
this.user = {
|
|
|
|
_id: '12390i',
|
|
|
|
email: 'bob@bob.com',
|
2021-04-27 03:52:58 -04:00
|
|
|
remove: sinon.stub().callsArgWith(0),
|
2019-05-29 05:21:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
this.TeamInvitesHandler = {
|
2021-04-27 03:52:58 -04:00
|
|
|
createTeamInvitesForLegacyInvitedEmail: sinon.stub().yields(),
|
2019-05-29 05:21:06 -04:00
|
|
|
}
|
|
|
|
|
2020-02-27 07:45:53 -05:00
|
|
|
this.UserHandler = SandboxedModule.require(modulePath, {
|
2019-05-29 05:21:06 -04:00
|
|
|
requires: {
|
2021-04-27 03:52:58 -04:00
|
|
|
'../Subscription/TeamInvitesHandler': this.TeamInvitesHandler,
|
|
|
|
},
|
2020-02-27 07:45:53 -05:00
|
|
|
})
|
2019-05-29 05:21:06 -04:00
|
|
|
})
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
describe('populateTeamInvites', function () {
|
|
|
|
beforeEach(function (done) {
|
2020-02-27 07:45:53 -05:00
|
|
|
this.UserHandler.populateTeamInvites(this.user, done)
|
2019-05-29 05:21:06 -04:00
|
|
|
})
|
|
|
|
|
2021-04-14 09:17:21 -04:00
|
|
|
it('notifies the user about legacy team invites', function () {
|
2020-02-27 07:45:53 -05:00
|
|
|
this.TeamInvitesHandler.createTeamInvitesForLegacyInvitedEmail
|
2019-05-29 05:21:06 -04:00
|
|
|
.calledWith(this.user.email)
|
|
|
|
.should.eq(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|