Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1144 from 18F/js-clear-notifications
Browse files Browse the repository at this point in the history
add tests for on CLEAR for user store
  • Loading branch information
rememberlenny authored Jun 28, 2017
2 parents 25f8098 + 1cc7900 commit 2c412ff
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion static_src/test/unit/stores/user_store.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AppDispatcher from '../../../dispatcher.js';
import cfApi from '../../../util/cf_api.js';
import { UserStore as _UserStore } from '../../../stores/user_store.js';
import userActions from '../../../actions/user_actions.js';
import { userActionTypes } from '../../../constants';
import { userActionTypes, errorActionTypes } from '../../../constants';

describe('UserStore', function () {
let sandbox, UserStore;
Expand Down Expand Up @@ -828,6 +828,29 @@ describe('UserStore', function () {
});
});

describe('on CLEAR', () => {
beforeEach(function() {
const notice = { noticeType: "finish", description: "message" };
UserStore._inviteNotification = notice;
UserStore._error = 'something';
UserStore._saving = true;
UserStore._inviteError = 'invite error';
UserStore._loading = {currentUser: true};
sandbox.spy(UserStore, 'emitChange');
AppDispatcher.handleViewAction({
type: errorActionTypes.CLEAR,
});

});
it('resets all of the notifications and errors', () => {
expect(UserStore._inviteNotification).toEqual({});
expect(UserStore._error).toBe(null);
expect(UserStore._saving).toEqual(false);
expect(UserStore._inviteError).toBe(null);
expect(UserStore._loading).toEqual({});
});
});

describe('currentlyViewedType()', function () {
describe('user with _currentViewedType', function () {
let user, space, org, actual;
Expand Down

0 comments on commit 2c412ff

Please sign in to comment.