2016-02-18 05:06:21 -05:00
|
|
|
sinon = require('sinon')
|
|
|
|
chai = require('chai')
|
|
|
|
should = chai.should()
|
|
|
|
modulePath = "../../../../app/js/Features/User/UserHandler.js"
|
|
|
|
SandboxedModule = require('sandboxed-module')
|
|
|
|
|
|
|
|
describe "UserHandler", ->
|
|
|
|
|
|
|
|
beforeEach ->
|
2018-06-01 06:28:06 -04:00
|
|
|
@user =
|
2016-02-18 05:06:21 -05:00
|
|
|
_id:"12390i"
|
|
|
|
email: "bob@bob.com"
|
|
|
|
remove: sinon.stub().callsArgWith(0)
|
|
|
|
|
2018-06-06 07:35:13 -04:00
|
|
|
@TeamInvitesHandler =
|
|
|
|
createTeamInvitesForLegacyInvitedEmail: sinon.stub().yields()
|
|
|
|
|
2016-02-18 05:06:21 -05:00
|
|
|
@UserHandler = SandboxedModule.require modulePath, requires:
|
2018-06-06 07:35:13 -04:00
|
|
|
"../Subscription/TeamInvitesHandler": @TeamInvitesHandler
|
|
|
|
|
|
|
|
describe "populateTeamInvites", ->
|
|
|
|
beforeEach (done)->
|
|
|
|
@UserHandler.populateTeamInvites @user, done
|
|
|
|
|
|
|
|
it "notifies the user about legacy team invites", ->
|
|
|
|
@TeamInvitesHandler.createTeamInvitesForLegacyInvitedEmail
|
|
|
|
.calledWith(@user.email).should.eq true
|
2016-02-18 05:06:21 -05:00
|
|
|
|