57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import { buildAdminBookingWorkspaceVM } from "./booking.vm.js";
|
|
|
|
describe("admin booking workspace view model", () => {
|
|
it("projects booking operations without Prisma or client recomputation", () => {
|
|
vi.setSystemTime(new Date("2026-07-25T12:00:00.000Z"));
|
|
const vm = buildAdminBookingWorkspaceVM({
|
|
meetingTypes: [
|
|
{
|
|
id: "type-1",
|
|
name: "Demo",
|
|
durationMinutes: 45,
|
|
hostAdminUserIds: ["admin-1", "admin-1"],
|
|
active: true,
|
|
},
|
|
],
|
|
pages: [
|
|
{
|
|
id: "page-1",
|
|
title: "HiveGrid Demo",
|
|
slug: "demo",
|
|
published: true,
|
|
meetingType: { name: "Demo" },
|
|
},
|
|
],
|
|
bookings: [
|
|
{
|
|
id: "booking-1",
|
|
startsAt: new Date("2026-08-01T10:00:00.000Z"),
|
|
endsAt: new Date("2026-08-01T10:45:00.000Z"),
|
|
status: "confirmed",
|
|
providerSyncedAt: new Date(),
|
|
contact: { firstName: "Ada", lastName: "Lovelace" },
|
|
meetingType: { name: "Demo" },
|
|
},
|
|
],
|
|
connectedCalendars: 1,
|
|
bookingOrigin: "https://meet.hivegrid.de",
|
|
});
|
|
|
|
expect(vm.stats).toEqual({
|
|
upcoming: 1,
|
|
publishedPages: 1,
|
|
activeMeetingTypes: 1,
|
|
connectedCalendars: 1,
|
|
});
|
|
expect(vm.pages[0]?.bookingUrl).toBe(
|
|
"https://meet.hivegrid.de/demo"
|
|
);
|
|
expect(vm.bookings[0]).toMatchObject({
|
|
contactName: "Ada Lovelace",
|
|
providerSynced: true,
|
|
});
|
|
vi.useRealTimers();
|
|
});
|
|
});
|