"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");

var ApiActions = _interopRequireWildcard(require("./apiActions"));

describe('apiActions', function () {
  describe('toggleModule', function () {
    it('should send the correct option payload', function () {
      var spy = jest.fn();
      ApiActions.toggleModule(spy);
      expect(spy).toHaveBeenCalledWith({
        method: 'POST',
        path: 'tutorials/toggleModule'
      });
    });
  });
  describe('getTutorials', function () {
    it('should send the correct option payload', function () {
      var spy = jest.fn();
      ApiActions.getTutorials(spy);
      expect(spy).toHaveBeenCalledWith({
        method: 'GET',
        path: 'tutorials/data'
      });
    });
  });
  describe('getTutorialBySlug', function () {
    it('should send the correct option payload', function () {
      var spy = jest.fn();
      ApiActions.getTutorialBySlug(spy, {
        slug: 'test'
      });
      expect(spy).toHaveBeenCalledWith({
        method: 'GET',
        path: 'tutorials/test/data'
      });
    });
  });
  describe('makeHero', function () {
    it('should send the correct option payload', function () {
      var spy = jest.fn();
      ApiActions.makeHero(spy, {
        _id: '123'
      });
      expect(spy).toHaveBeenCalledWith({
        method: 'POST',
        path: 'tutorials/123/makeHero'
      });
    });
  });
  describe('shiftOrder', function () {
    it('should send the correct option payload', function () {
      var spy = jest.fn();
      ApiActions.shiftOrder(spy, {
        _id: '123',
        direction: 1
      });
      expect(spy).toHaveBeenCalledWith({
        method: 'POST',
        path: 'tutorials/123/shiftOrder',
        body: JSON.stringify({
          _id: '123',
          direction: 1
        })
      });
    });
  });
  describe('updateTutorial', function () {
    it('should send the correct option payload', function () {
      var spy = jest.fn();
      ApiActions.updateTutorial(spy, {
        _id: '123',
        published: true
      });
      expect(spy).toHaveBeenCalledWith({
        method: 'PUT',
        path: 'tutorials/123',
        body: JSON.stringify({
          _id: '123',
          published: true
        })
      });
    });
  });
  describe('deleteTutorial', function () {
    it('should send the correct option payload', function () {
      var spy = jest.fn();
      ApiActions.deleteTutorial(spy, {
        _id: '123'
      });
      expect(spy).toHaveBeenCalledWith({
        method: 'DELETE',
        path: 'tutorials/123'
      });
    });
  });
});