2019-05-29 05:21:06 -04:00
|
|
|
/* eslint-disable
|
|
|
|
max-len,
|
|
|
|
no-return-assign,
|
|
|
|
no-unused-vars,
|
|
|
|
*/
|
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
// Fix any style issues and re-enable lint.
|
|
|
|
/*
|
|
|
|
* decaffeinate suggestions:
|
|
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
*/
|
|
|
|
const sinon = require('sinon')
|
|
|
|
const chai = require('chai')
|
|
|
|
const should = chai.should()
|
|
|
|
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()
|
|
|
|
}
|
|
|
|
|
|
|
|
return (this.UserHandler = SandboxedModule.require(modulePath, {
|
|
|
|
requires: {
|
|
|
|
'../Subscription/TeamInvitesHandler': this.TeamInvitesHandler
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
})
|
|
|
|
|
2019-06-21 09:46:09 -04:00
|
|
|
describe('populateTeamInvites', function() {
|
2019-05-29 05:21:06 -04:00
|
|
|
beforeEach(function(done) {
|
|
|
|
return this.UserHandler.populateTeamInvites(this.user, done)
|
|
|
|
})
|
|
|
|
|
2019-06-21 09:46:09 -04:00
|
|
|
it('notifies the user about legacy team invites', function() {
|
2019-05-29 05:21:06 -04:00
|
|
|
return this.TeamInvitesHandler.createTeamInvitesForLegacyInvitedEmail
|
|
|
|
.calledWith(this.user.email)
|
|
|
|
.should.eq(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|