"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = require("@testing-library/react");
const use_stepper_1 = require("./use-stepper");
describe('useStepper', () => {
    it('should initialize with the correct step', () => {
        const { result } = (0, react_1.renderHook)(() => (0, use_stepper_1.useStepper)({}));
        expect(result.current.step).toBe(0);
    });
    it('should go to the next step', () => {
        const { result } = (0, react_1.renderHook)(() => (0, use_stepper_1.useStepper)({}));
        (0, react_1.act)(() => {
            result.current.handleNext();
        });
        expect(result.current.step).toBe(1);
    });
    it('should go to the previous step', () => {
        const { result } = (0, react_1.renderHook)(() => (0, use_stepper_1.useStepper)({ defaultStep: 1 }));
        (0, react_1.act)(() => {
            result.current.handlePrevious();
        });
        expect(result.current.step).toBe(0);
    });
    it('should not go below step 0', () => {
        const { result } = (0, react_1.renderHook)(() => (0, use_stepper_1.useStepper)({}));
        (0, react_1.act)(() => {
            result.current.handlePrevious();
        });
        expect(result.current.step).toBe(0);
    });
    it('should not exceed the maximum steps', () => {
        const { result } = (0, react_1.renderHook)(() => (0, use_stepper_1.useStepper)({ maxSteps: 2 }));
        expect(result.current.step).toBe(0);
        (0, react_1.act)(() => {
            result.current.handleNext();
        });
        (0, react_1.act)(() => {
            result.current.handleNext();
        });
        (0, react_1.act)(() => {
            result.current.handleNext();
        });
        expect(result.current.step).toBe(1);
    });
});
