13 lines
571 B
TypeScript
13 lines
571 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { checkoutExpired, checkoutExpiresAt } from "./checkout-expiration";
|
|
|
|
describe("commission checkout window", () => {
|
|
it("expires exactly one hour after each checkout was created", () => {
|
|
const createdAt = new Date("2026-10-01T12:00:00.000Z");
|
|
const expiresAt = checkoutExpiresAt(createdAt);
|
|
expect(expiresAt).toBe(new Date("2026-10-01T13:00:00.000Z").getTime());
|
|
expect(checkoutExpired(createdAt, expiresAt - 1)).toBe(false);
|
|
expect(checkoutExpired(createdAt, expiresAt)).toBe(true);
|
|
});
|
|
});
|