{"size": 779, "ext": "js", "max_stars_repo_path": "__tests__/reducers/myReservationsReducer.js", "max_stars_repo_name": "artruusi/parkdude-mobile", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "__tests__/reducers/myReservationsReducer.js", "max_issues_repo_name": "artruusi/parkdude-mobile", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "__tests__/reducers/myReservationsReducer.js", "max_forks_repo_name": "artruusi/parkdude-mobile", "max_forks_repo_forks_event_min_datetime": "2020-02-13T11:15:16.000Z", "max_forks_repo_forks_event_max_datetime": "2020-02-13T11:15:16.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 33.8695652174, "max_line_length": 79, "alphanum_fraction": 0.6456996149}
import {myReservationsReducer} from '../../src/reducers/myReservationsReducer';
import {MY_PARKINGS} from '../../src/actions/actionTypes';

const initialState = {ownedSpots: [], reservations: [], releases: []};
const mockPayload = {
  ownedSpots: [{id: '200', name: '200'}],
  reservations: [{date: '2020-02-02', parkingSpot: {id: '100', name: '100'}}],
  releases: [{date: '2020-03-03', parkingSpot: {id: '200', name: '200'}}]
};

describe('myReservationsReducer', () => {
  it('should return the initial state', () => {
    expect(myReservationsReducer(undefined, {})).toEqual(initialState);
  });

  it('should own reservations', () => {
    expect(myReservationsReducer(undefined, {
      type: MY_PARKINGS,
      payload: mockPayload
    })).toEqual(mockPayload);
  });
});
