Rocky_Mountain_Vending/.pnpm-store/v10/files/71/a5f4d00df42d3d240b0a508eb7b13e50523031b7603c53955e318514d6599fc0e4325801ecffa5ec83a836d6eaaf0c7a86d2ceb56071cb548c10acc37970d5
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

38 lines
1.1 KiB
Text

import { act, renderHook } from "@/test/render";
import { defaultDateLib } from "../classes/DateLib";
import { DayPickerProps } from "../types";
import { useSingle } from "./useSingle";
describe("useSingle", () => {
it("uses the selected value from props when onSelect is provided", () => {
const mockOnSelect = jest.fn();
const selectedDate = new Date(2023, 9, 1);
const props: DayPickerProps = {
mode: "single",
selected: selectedDate,
onSelect: mockOnSelect
};
const { result } = renderHook(() => useSingle(props, defaultDateLib));
expect(result.current.selected).toBe(selectedDate);
});
it("uses the internally selected value when onSelect is not provided", () => {
const initialSelectedDate = new Date(2023, 9, 1);
const props: DayPickerProps = {
mode: "single",
selected: initialSelectedDate
};
const { result } = renderHook(() => useSingle(props, defaultDateLib));
act(() => {
result.current.select?.(new Date(2023, 9, 2), {}, {} as React.MouseEvent);
});
expect(result.current.selected).toEqual(new Date(2023, 9, 2));
});
});