import { renderHook, act } from "testUtilities";
import useToggle from ".";
it("returns the false by default", function () {
  var _renderHook = renderHook(function (value) {
      return useToggle(value);
    }, {
      initialProps: undefined
    }),
    result = _renderHook.result;
  expect(result.current[0]).toBe(false);
});
it("returns the initial value", function () {
  var _renderHook2 = renderHook(function (value) {
      return useToggle(value);
    }, {
      initialProps: true
    }),
    result = _renderHook2.result;
  expect(result.current[0]).toBe(true);
});
it("toggles the value", function () {
  var _renderHook3 = renderHook(function (value) {
      return useToggle(value);
    }, {
      initialProps: true
    }),
    result = _renderHook3.result;
  var _result$current = result.current,
    toggle = _result$current[1];
  act(function () {
    toggle();
  });
  expect(result.current[0]).toBe(false);
  act(function () {
    toggle();
  });
  expect(result.current[0]).toBe(true);
});
it("toggles on", function () {
  var _renderHook4 = renderHook(function (value) {
      return useToggle(value);
    }, {
      initialProps: false
    }),
    result = _renderHook4.result;
  var _result$current2 = result.current,
    toggleOn = _result$current2[2];
  act(function () {
    toggleOn();
  });
  expect(result.current[0]).toBe(true);
});
it("toggles off", function () {
  var _renderHook5 = renderHook(function (value) {
      return useToggle(value);
    }, {
      initialProps: true
    }),
    result = _renderHook5.result;
  var _result$current3 = result.current,
    toggleOff = _result$current3[3];
  act(function () {
    toggleOff();
  });
  expect(result.current[0]).toBe(false);
});