{"size": 2035, "ext": "js", "max_stars_repo_path": "src/state/organizations/actions.test.js", "max_stars_repo_name": "Stanford-PERTS/triton", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/state/organizations/actions.test.js", "max_issues_repo_name": "Stanford-PERTS/triton", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/state/organizations/actions.test.js", "max_forks_repo_name": "Stanford-PERTS/triton", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.9264705882, "max_line_length": 77, "alphanum_fraction": 0.6791154791}
import { actionMethods, actionStages } from 'state/actionTypes';
import * as actions from './actions';
import * as types from './actionTypes';

describe('organizations actions', () => {
  const organization = {
    uid: 'Organization_xLVvxhai5qeAQjCR',
    name: 'Random Organization Name',
  };

  it('should create an action to request organizations', () => {
    const expectedAction = {
      actionSlice: 'ORGANIZATIONS',
      actionMethod: actionMethods.QUERY,
      actionStage: actionStages.REQUEST,
      type: types.ORGANIZATIONS_REQUEST,
    };
    expect(actions.queryOrganizations()).toEqual(expectedAction);
  });

  it('should create an action to request an organization', () => {
    const organizationId = 'Organization_001';
    const expectedAction = {
      actionSlice: 'ORGANIZATIONS',
      actionMethod: actionMethods.GET,
      actionStage: actionStages.REQUEST,
      actionUids: [organizationId],
      type: types.ORGANIZATION_REQUEST,
      organizationId,
    };
    expect(actions.getOrganization(organizationId)).toEqual(expectedAction);
  });

  it('should create an action to add new organization', () => {
    const expectedAction = {
      type: types.ORGANIZATION_ADD_REQUEST,
      organization,
    };
    expect(actions.addOrganization(organization)).toEqual(expectedAction);
  });

  it('should create an action to update an organization', () => {
    const expectedAction = {
      type: types.ORGANIZATION_UPDATE_REQUEST,
      organization,
    };
    expect(actions.updateOrganization(organization)).toEqual(expectedAction);
  });

  it('should create an action to set mode', () => {
    const mode = 'add';
    const expectedAction = {
      type: types.ORGANIZATION_MODE_SET,
      mode,
    };

    expect(actions.setOrganizationMode(mode)).toEqual(expectedAction);
  });

  it('should create an action to reset mode', () => {
    const expectedAction = {
      type: types.ORGANIZATION_MODE_RESET,
    };

    expect(actions.resetOrganizationMode()).toEqual(expectedAction);
  });
});
