Rocky_Mountain_Vending/.pnpm-store/v10/files/94/d7f86dd80979ade7ba40789cb437f8f091e5fc8e0bb4c41763e6f90f23961fea575afb21e96cbf95676c2fd55407a8c364bb80aa3871c69d5e57c4f7dec40a
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

101 lines
3 KiB
Text

import { addMonths, isSameMonth } from "date-fns";
import { defaultDateLib } from "../classes/DateLib";
import { getNextMonth } from "./getNextMonth";
const startingMonth = new Date(2020, 4, 31);
describe("when number of months is 1", () => {
describe("when the navigation is disabled", () => {
it("the next month is undefined", () => {
const result = getNextMonth(
startingMonth,
undefined,
{
disableNavigation: true
},
defaultDateLib
);
expect(result).toBe(undefined);
});
});
describe("when in the navigable range", () => {
const endMonth = addMonths(startingMonth, 3);
it("the next month is not undefined", () => {
const result = getNextMonth(startingMonth, endMonth, {}, defaultDateLib);
const expectedNextMonth = addMonths(startingMonth, 1);
expect(result && isSameMonth(result, expectedNextMonth)).toBeTruthy();
});
});
describe("when not in the navigable range", () => {
const endMonth = startingMonth;
it("the next month is undefined", () => {
const result = getNextMonth(startingMonth, endMonth, {}, defaultDateLib);
expect(result).toBe(undefined);
});
});
});
describe("when displaying 3 months", () => {
const numberOfMonths = 3;
describe("when the navigation is paged", () => {
const pagedNavigation = true;
it("the next month is 3 months ahead", () => {
const result = getNextMonth(
startingMonth,
undefined,
{
numberOfMonths,
pagedNavigation
},
defaultDateLib
);
const expectedNextMonth = addMonths(startingMonth, 3);
expect(result && isSameMonth(result, expectedNextMonth)).toBeTruthy();
});
describe("when the to-date is ahead less than 3 months", () => {
it("the next month is undefined", () => {
const result = getNextMonth(
startingMonth,
addMonths(startingMonth, 1),
{
numberOfMonths,
pagedNavigation
},
defaultDateLib
);
expect(result).toBe(undefined);
});
});
});
describe("when the navigation is not paged", () => {
const pagedNavigation = false;
it("the next month is 1 months ahead", () => {
const result = getNextMonth(
startingMonth,
undefined,
{
numberOfMonths,
pagedNavigation
},
defaultDateLib
);
const expectedNextMonth = addMonths(startingMonth, 1);
expect(result && isSameMonth(result, expectedNextMonth)).toBeTruthy();
});
describe("when the to-date is ahead less than 3 months", () => {
it("the next month is undefined", () => {
const result = getNextMonth(
startingMonth,
addMonths(startingMonth, 2),
{
numberOfMonths,
pagedNavigation
},
defaultDateLib
);
expect(result).toBe(undefined);
});
});
});
});