{"size": 1297, "ext": "js", "max_stars_repo_path": "tests/reducers/history/bugsHistory.test.js", "max_stars_repo_name": "rocket-internet-berlin/RocketDashboard", "max_stars_repo_stars_event_min_datetime": "2017-05-17T09:38:55.000Z", "max_stars_repo_stars_event_max_datetime": "2019-06-01T12:30:30.000Z", "max_issues_repo_path": "tests/reducers/history/bugsHistory.test.js", "max_issues_repo_name": "rocket-internet-berlin/RocketDashboard", "max_issues_repo_issues_event_min_datetime": "2017-05-08T12:55:26.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-12T12:53:30.000Z", "max_forks_repo_path": "tests/reducers/history/bugsHistory.test.js", "max_forks_repo_name": "rocket-internet-berlin/RocketDashboard", "max_forks_repo_forks_event_min_datetime": "2017-10-23T09:39:48.000Z", "max_forks_repo_forks_event_max_datetime": "2017-10-23T09:39:48.000Z"}
{"max_stars_count": 11, "max_issues_count": 37, "max_forks_count": 1, "avg_line_length": 19.6515151515, "max_line_length": 81, "alphanum_fraction": 0.3554356207}
import bugsHistory from '../../../src/reducers/history/bugsHistory';

describe('history reducer', () => {
  it('updates the state with the data from a RECEIVE_BUGSHISTORY action', () => {
    expect(
      bugsHistory(
        {
          history: [],
        },
        {
          type: 'RECEIVE_BUGSHISTORY',
          payload: {
            history: [
              {
                openBugs: 1,
                solvedBugs: 2,
                newBugs: 3,
              },
              {
                openBugs: 4,
                solvedBugs: 5,
                newBugs: 6,
              },
            ],
          },
        },
      ),
    ).toEqual(expect.objectContaining({
      history: [
        {
          openBugs: 1,
          solvedBugs: 2,
          newBugs: 3,
        },
        {
          openBugs: 4,
          solvedBugs: 5,
          newBugs: 6,
        },
      ],
    }));
  });

  it('does not handle other actions', () => {
    expect(
      bugsHistory(
        {
          history: [],
        },
        {
          type: 'RECEIVE_WEEKNUMBER',
          payload: [
            {
              openBugs: 9,
              solvedBugs: 9,
              newBugs: 9,
            },
          ],
        },
      ),
    ).toEqual({
      history: [],
    });
  });
});
