UserHandlerTests.js 980 B

1234567891011121314151617181920212223242526272829303132333435
  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. requires: {
  16. '../Subscription/TeamInvitesHandler': this.TeamInvitesHandler,
  17. },
  18. })
  19. })
  20. describe('populateTeamInvites', function () {
  21. beforeEach(function (done) {
  22. this.UserHandler.populateTeamInvites(this.user, done)
  23. })
  24. it('notifies the user about legacy team invites', function () {
  25. this.TeamInvitesHandler.createTeamInvitesForLegacyInvitedEmail
  26. .calledWith(this.user.email)
  27. .should.eq(true)
  28. })
  29. })
  30. })