48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { buildAdminBookingSettingsVM } from "./booking-settings.vm.js";
|
|
|
|
describe("buildAdminBookingSettingsVM", () => {
|
|
it("serializes host labels, rules and date overrides", () => {
|
|
const vm = buildAdminBookingSettingsVM({
|
|
meetingTypes: [{
|
|
id: "type-1",
|
|
name: "Demo",
|
|
slug: "demo",
|
|
durationMinutes: 45,
|
|
active: true,
|
|
hostAdminUserIds: ["admin-1"],
|
|
}],
|
|
pages: [{
|
|
id: "page-1",
|
|
meetingTypeId: "type-1",
|
|
title: "Demo",
|
|
slug: "demo",
|
|
published: true,
|
|
}],
|
|
hosts: [{
|
|
id: "admin-1",
|
|
firstName: "Raffael",
|
|
lastName: "Sheikh",
|
|
email: "admin@email.com",
|
|
}],
|
|
rules: [{
|
|
dayOfWeek: "monday",
|
|
startMinutes: 540,
|
|
endMinutes: 1020,
|
|
timeZone: "Europe/Berlin",
|
|
}],
|
|
overrides: [{
|
|
date: new Date("2026-08-03T00:00:00.000Z"),
|
|
kind: "unavailable",
|
|
startMinutes: null,
|
|
endMinutes: null,
|
|
reason: "Urlaub",
|
|
timeZone: "Europe/Berlin",
|
|
}],
|
|
});
|
|
expect(vm.hosts[0]?.label).toBe("Raffael Sheikh");
|
|
expect(vm.availability.overrides[0]?.date).toBe("2026-08-03");
|
|
expect(vm.availability.timeZone).toBe("Europe/Berlin");
|
|
});
|
|
});
|