"use strict";
const react_esm = require('./../_node_modules/@testing-library/react/dist/@testing-library/react.esm.cjs');
const usePreviousValue = require("./usePreviousValue.cjs");
describe("usePreviousValue", () => {
  it("should return the previous value before the effect cycle", () => {
    const { result, rerender } = react_esm.renderHook((props) => usePreviousValue.usePreviousValue(props), {
      initialProps: "initial"
    });
    expect(result.current).toBeUndefined();
    rerender("updated");
    expect(result.current).toBe("initial");
    rerender("new value");
    expect(result.current).toBe("updated");
  });
  it("should return undefined when the value is undefined", () => {
    const { result, rerender } = react_esm.renderHook((props) => usePreviousValue.usePreviousValue(props), {
      initialProps: void 0
    });
    expect(result.current).toBeUndefined();
    rerender("updated");
    expect(result.current).toBeUndefined();
  });
  it("should return the previous value for complex objects", () => {
    const initialValue = { name: "John", age: 25 };
    const updatedValue = { name: "John", age: 30 };
    const { result, rerender } = react_esm.renderHook((props) => usePreviousValue.usePreviousValue(props), {
      initialProps: initialValue
    });
    expect(result.current).toBeUndefined();
    rerender(updatedValue);
    expect(result.current).toBe(initialValue);
  });
});
//# sourceMappingURL=usePreviousValue.spec.cjs.map
