jest.mock('../../apiClients', () => ({
  fetchSlots: (date) => (
    new Promise((resolve, reject) => (
      date === 'failing date' ?
        reject({ response: { error: 'fails'}, status: 402, ok: false}) :
        resolve({ slots: [{ id: 1 }, { id: 2 }], status: 200, ok: true } )
    ))
  )
}));

import {
  fetchSlots,
  fetchSlotsRequest,
  fetchSlotsSuccess,
  fetchSlotsFailure } from '../../actions';
import sinon from 'sinon';

// Redux-saga

it('fetchSlotsRequest creates action with date', () => (
  expect(fetchSlotsRequest('date')).toEqual({
    type: "FETCH_SLOTS_REQUEST",
    date: 'date'
  })
));

it('fetchSlotsSuccess creates action with date', () => {
  const response = {
    slots: [{ id: 1 }, { id: 2 }],
    status: 200, ok: true,
    date: 'date'
  };

  expect(fetchSlotsSuccess(response)).toEqual({
    type: "FETCH_SLOTS_SUCCESS",
    response: {
      entities: {
        slots: { 1: { id: 1 }, 2: { id: 2 } }
      },
      result: [1, 2],
      date: 'date'
    }
  })
});

it('fetchSlotsRequest creates action with date', () => (
  expect(fetchSlotsFailure('date', 'errors')).toEqual({
    type: "FETCH_SLOTS_FAILURE",
    date: 'date', errors: 'errors'
  })
));

//// Redux-thunk

@@ -1,327 +1,12 @@
-jest.mock('../../apiClients', () =%3E (%7B%0A  fetchSlots: (date) =%3E (%0A    new Promise((resolve, reject) =%3E (%0A      date === 'failing date' ?%0A        reject(%7B response: %7B error: 'fails'%7D, status: 402, ok: false%7D) :%0A        resolve(%7B slots: %5B%7B id: 1 %7D, %7B id: 2 %7D%5D, status: 200, ok: true %7D )%0A    ))%0A  )%0A%7D));%0A%0Aimport %7B%0A  fetchSlots,
+import %7B
 %0A  f
@@ -91,50 +91,8 @@
 ns';
-%0Aimport sinon from 'sinon';%0A%0A// Redux-saga
 %0A%0Ait
@@ -836,22 +836,4 @@
 ));%0A
-%0A//// Redux-thunk%0A

clean up action tests