UserHandlerTests.js 1022 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. const sinon = require('sinon')
  2. const modulePath = '../../../../app/src/Features/User/UserHandler.js'
  3. const SandboxedModule = require('sandboxed-module')
  4. describe('UserHandler', function() {
  5. beforeEach(function() {
  6. this.user = {
  7. _id: '12390i',
  8. email: 'bob@bob.com',
  9. remove: sinon.stub().callsArgWith(0)
  10. }
  11. this.TeamInvitesHandler = {
  12. createTeamInvitesForLegacyInvitedEmail: sinon.stub().yields()
  13. }
  14. this.UserHandler = SandboxedModule.require(modulePath, {
  15. globals: {
  16. console: console
  17. },
  18. requires: {
  19. '../Subscription/TeamInvitesHandler': this.TeamInvitesHandler
  20. }
  21. })
  22. })
  23. describe('populateTeamInvites', function() {
  24. beforeEach(function(done) {
  25. this.UserHandler.populateTeamInvites(this.user, done)
  26. })
  27. it('notifies the user about legacy team invites', function() {
  28. this.TeamInvitesHandler.createTeamInvitesForLegacyInvitedEmail
  29. .calledWith(this.user.email)
  30. .should.eq(true)
  31. })
  32. })
  33. })