{"size": 2195, "ext": "js", "max_stars_repo_path": "src/bundles/ApplicationsAdmin/redux/modules/__tests__/applications.test.js", "max_stars_repo_name": "ArenaNetworks/dto-digitalmarketplace-frontend", "max_stars_repo_stars_event_min_datetime": "2016-10-13T02:15:00.000Z", "max_stars_repo_stars_event_max_datetime": "2020-12-14T12:28:07.000Z", "max_issues_repo_path": "src/bundles/ApplicationsAdmin/redux/modules/__tests__/applications.test.js", "max_issues_repo_name": "ArenaNetworks/dto-digitalmarketplace-frontend", "max_issues_repo_issues_event_min_datetime": "2016-10-12T05:06:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T03:59:24.000Z", "max_forks_repo_path": "src/bundles/ApplicationsAdmin/redux/modules/__tests__/applications.test.js", "max_forks_repo_name": "AusDTO/dto-digitalmarketplace-frontend", "max_forks_repo_forks_event_min_datetime": "2017-03-26T07:25:29.000Z", "max_forks_repo_forks_event_max_datetime": "2021-02-15T10:32:42.000Z"}
{"max_stars_count": 13, "max_issues_count": 87, "max_forks_count": 8, "avg_line_length": 20.5140186916, "max_line_length": 88, "alphanum_fraction": 0.5412300683}
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';

import reducer, { convertedSeller, convertApplicationToSeller, CONVERTED_SELLER,
  rejectedApplication, rejectApplication, REJECTED_APPLICATION } from '../applications';

test('convertseller action', () => {
  const expectedAction = {
    type: CONVERTED_SELLER,
    id: 1
  };
  expect(convertedSeller(1)).toEqual(expectedAction);
});

test('convertedSeller reducer', () => {
  const expectedActions = [
    { type: CONVERTED_SELLER, id: 99 }
  ]

  const state = [
      {
        id: 99,
        name: 'An app',
        email: 'b@example.com',
        status: 'submitted'
      },
      {
        id: 100,
        name: 'An app',
        email: 'a@example.com',
        status: 'submitted'
      }
    ];

  const expected = [
      {
        id: 99,
        name: 'An app',
        email: 'b@example.com',
        status: 'approved'
      },
      {
        id: 100,
        name: 'An app',
        email: 'a@example.com',
        status: 'submitted'
      }
    ];

  expect(reducer(state, convertedSeller(99))).toEqual(expected);
});


test('rejectapplication action', () => {
  const expectedAction = {
    type: REJECTED_APPLICATION,
    id: 1
  };
  expect(rejectedApplication(1)).toEqual(expectedAction);
});

test('rejectedApplication reducer', () => {
  const expectedActions = [
    { type: REJECTED_APPLICATION, id: 99 }
  ]

  const state = [
      {
        id: 99,
        name: 'An app',
        email: 'b@example.com',
        status: 'submitted'
      },
      {
        id: 100,
        name: 'An app',
        email: 'a@example.com',
        status: 'submitted'
      }
    ];

  const expected = [
      {
        id: 99,
        name: 'An app',
        email: 'b@example.com',
        status: 'approval_rejected'
      },
      {
        id: 100,
        name: 'An app',
        email: 'a@example.com',
        status: 'submitted'
      }
    ];

  expect(reducer(state, rejectedApplication(99))).toEqual(expected);
});



test('default reducer', () => {
  expect(reducer()).toEqual({});
  expect(reducer({})).toEqual({});
  expect(reducer({ foo: 'bar' })).toEqual({ foo: 'bar' });
});
