Rocky_Mountain_Vending/.pnpm-store/v10/files/cf/f5835faa70e539f1823724627664f6d44005563f292c328c0e7ecab7420099e4a6d7627899bdad6ccdce9f771be03feeb71c6b0efc33982c6b096a60d0d310
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

60 lines
2.2 KiB
Text

import { defaultDateLib } from "../classes/DateLib";
import { rangeOverlaps } from "./rangeOverlaps";
const sunday = new Date(2024, 8, 1);
const monday = new Date(2024, 8, 2);
const tuesday = new Date(2024, 8, 3);
const thursday = new Date(2024, 8, 5);
const saturday = new Date(2024, 8, 7);
const nextWeekSunday = new Date(2024, 8, 8);
const leftRange = { from: monday, to: saturday };
test('should return true when matching the "from" date', () => {
const rightRange = { from: sunday, to: monday };
const result = rangeOverlaps(leftRange, rightRange, defaultDateLib);
expect(result).toBe(true);
});
test('should return true when matching the "to" date', () => {
const rightRange = { from: saturday, to: nextWeekSunday };
const result = rangeOverlaps(leftRange, rightRange, defaultDateLib);
expect(result).toBe(true);
});
test("should return true when left date range contains right date range", () => {
const rightRange = { from: tuesday, to: thursday };
const result = rangeOverlaps(leftRange, rightRange, defaultDateLib);
expect(result).toBe(true);
});
test("should return true when right date range contains left date range", () => {
const rightRange = { from: sunday, to: nextWeekSunday };
const result = rangeOverlaps(leftRange, rightRange, defaultDateLib);
expect(result).toBe(true);
});
test("should return true when a date range is inverted", () => {
const rightRange = { to: sunday, from: nextWeekSunday };
const result = rangeOverlaps(leftRange, rightRange, defaultDateLib);
expect(result).toBe(true);
});
test('should return false on the edge of the "from" date', () => {
const rightRange = { from: new Date(2000, 1, 1), to: sunday };
const result = rangeOverlaps(leftRange, rightRange, defaultDateLib);
expect(result).toBe(false);
});
test('should return false on the edge of the "to" date', () => {
const rightRange = { from: nextWeekSunday, to: new Date(2077, 1, 1) };
const result = rangeOverlaps(leftRange, rightRange, defaultDateLib);
expect(result).toBe(false);
});
test("should return false when a date range is inverted", () => {
const rightRange = { to: nextWeekSunday, from: new Date(2077, 1, 1) };
const result = rangeOverlaps(leftRange, rightRange, defaultDateLib);
expect(result).toBe(false);
});