Rocky_Mountain_Vending/.pnpm-store/v10/files/1a/1172a8f06430e69fe5956e15530e3fe70a9abf05e3e4963fea33c270eca78313359f6096a02e78988b2ae005174bb52e80c0616de696c6db5e3d184f071690
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

41 lines
1.2 KiB
Text

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