diff --git a/static_src/test/unit/actions/user_actions.spec.js b/static_src/test/unit/actions/user_actions.spec.js index 53197fba..5c208fea 100644 --- a/static_src/test/unit/actions/user_actions.spec.js +++ b/static_src/test/unit/actions/user_actions.spec.js @@ -230,31 +230,31 @@ describe('userActions', function() { // nice if the stores were not global singletons or if there was a way to // register our own store for the test. sandbox.stub(UserStore, 'get').returns('org_user'); - sandbox.stub(AppDispatcher, 'handleViewAction'); }); it('should dispatch a view event of type create invite notification with false', function(done) { - description = 'There was no cloud.gov account found for this@that.com or the user has not verified ' + - 'their account by logging in.They have been sent an email cloud.gov invitation. ' + - 'Their account has been associated to this space and their space roles can be ' + - 'controlled below.'; - userActions.createInviteNotification(false, email); - expect(AppDispatcher.handleViewAction).toHaveBeenCalledWith(sinon.match({ - type: userActionTypes.USER_INVITE_STATUS_DISPLAYED, + description = 'No verified cloud.gov account was found for this@that.com, so the user has been sent an email invitation. Their account has been associated to this space, and their space roles can be controlled below.'; + var expected = { noticeType, description - })); + }; + let spy = setupViewSpy(sandbox); + sandbox.spy(userActions, 'receivedInviteStatus'); + userActions.createInviteNotification(false, email); + assertAction(spy, userActionTypes.USER_INVITE_STATUS_DISPLAYED, expected); done(); }); + it('should dispatch a view event of type create invite notification with true', function(done) { - description = 'The account for this@that.com is now associated to this space. Control their ' + - 'space roles below.'; - userActions.createInviteNotification(true, email); - expect(AppDispatcher.handleViewAction).toHaveBeenCalledWith(sinon.match({ - type: userActionTypes.USER_INVITE_STATUS_DISPLAYED, + description = 'The cloud.gov account for this@that.com is now associated to this space. Control their space roles below.' to equal 'No verified cloud.gov account was found for this@that.com, so the user has been sent an email invitation. Their account has been associated to this space, and their space roles can be controlled below'; + var expected = { noticeType, description - })); + }; + let spy = setupViewSpy(sandbox); + sandbox.spy(userActions, 'receivedInviteStatus'); + userActions.createInviteNotification(true, email); + assertAction(spy, userActionTypes.USER_INVITE_STATUS_DISPLAYED, expected); done(); }); });