Files
calendar/packages/features/ee/round-robin/roundRobinReassignment.test.ts
T
Hariom BalharaandGitHub 95f7f03f0e chore: Integrate round-robin reassignment booking audit (#26586)
## What does this PR do?

Implements booking audit logging for round-robin reassignment events (both manual and automatic). This is part of the booking audit integration plan (PR 7).

Changes:
- Added audit logging to `roundRobinManualReassignment.ts` for manual host reassignments
- Added audit logging to `roundRobinReassignment.ts` for automatic round-robin reassignments
- Updated tRPC handlers to pass `actionSource: "WEBAPP"` and `reassignedByUuid`
- Updated API v2 bookings service to pass `actionSource: "API_V2"` and `reassignedByUuid`
- Updated `ReassignmentAuditActionService.ts` with proper field schemas and translation keys

The audit logging uses `BookingEventHandlerService.onReassignment()` with proper actor identification and action source tracking.

## Updates since last revision

Addressed review feedback:
- Renamed `title` field to `hostName` for semantic clarity (tracks host name changes, not booking titles)
- Fixed `assignedById` schema: changed from `NumberChangeSchema` to `z.number()` (no old/new pattern needed - it's always the user who performed the reassignment)
- Fixed `reassignmentReason` schema: changed from `StringChangeSchema` to `z.string().nullable()` (no old/new pattern needed)
- Added `ValidActionSource` type that excludes `UNKNOWN` - clients must pass explicit action sources
- Made `actionSource` required in both reassignment functions (no longer optional)
- Added integration tests for `ReassignmentAuditActionService` (15 tests covering all methods)
- Updated `roundRobinManualReassign.handler.ts` to pass required `actionSource` and `reassignedByUuid` params

**Latest fixes:**
- Fixed `hasAttendeeUpdated` check in `ReassignmentAuditActionService.ts`: changed from `!== null` to `!= null` to properly handle undefined values
- Updated test expectations in `ReassignmentAuditActionService.test.ts` to match the new display JSON field names (`hostAttendeeUserUuidNew`/`hostAttendeeUserUuidOld` instead of `newAssignedRRHostUuid`/`previousAssignedRRHostUuid`)
- Fixed async `getDisplayFields` tests to properly await the Promise and include the `previous_assignee` field
- Fixed `hasAttendeeUpdated` to check for `hostAttendeeUpdated` object presence instead of optional `id` field - host changes with only `withUserUuid` populated were being ignored (identified by Cubic AI, confidence 9/10)
- Fixed test expectation in `getDisplayJson` test: removed incorrect null expectations for `hostAttendeeIdUpdated`, `hostAttendeeUserUuidNew`, `hostAttendeeUserUuidOld` - the implementation uses conditional spreading to omit these fields when `hostAttendeeUpdated` is not present, rather than setting them to null

## Mandatory Tasks (DO NOT REMOVE)

- [x] I have self-reviewed the code (A decent size PR without self-review might be rejected).
- [x] I have updated the developer docs in /docs if this PR makes changes that would require a [documentation change](https://cal.com/docs). N/A - no documentation changes needed.
- [x] I confirm automated tests are in place that prove my fix is effective or that my feature works.

## How should this be tested?

1. Trigger a manual round-robin reassignment via the webapp and verify audit logs are created with `actionSource: "WEBAPP"`
2. Trigger an automatic round-robin reassignment and verify audit logs are created
3. Use API v2 to reassign a booking and verify audit logs are created with `actionSource: "API_V2"`
4. Verify the audit data contains correct values for `organizerUuid`, `hostAttendeeUpdated`, `reassignmentReason`, and `reassignmentType`

## Checklist

- [x] My code follows the style guidelines of this project
- [x] I have checked if my changes generate no new warnings

## Human Review Checklist


- [x] Verify the `hasAttendeeUpdated` fix is correct: now checks `fields.hostAttendeeUpdated != null` to detect any host attendee update regardless of whether `id` is populated
- [x] Verify `getDisplayJson` test fix: fields are correctly omitted (not set to null) when `hostAttendeeUpdated` is not present, matching the conditional spreading implementation
- [ ] Verify all callers of reassignment functions pass required `actionSource` and `reassignedByUuid`
- [ ] Confirm `getDisplayFields` is properly awaited in all call sites (it's now async)
- [ ] Check that `ValidActionSource` type properly excludes `UNKNOWN` for client-side validation

## Important Notes for Reviewer

1. **Dependency on base PR**: The translation key changes use the format from base PR (#26046). This PR should be merged after the base PR.

2. **Schema changes**: The `organizerUuid` and `hostAttendeeUpdated` fields track both organizer changes and round-robin host attendee changes separately for complete audit trail.

---


Link to Devin run: https://app.devin.ai/sessions/e4353e2ec6ea4a51ab33313bdc630aba
Requested by: @hariombalhara
2026-01-23 08:13:22 +05:30

704 lines
23 KiB
TypeScript

import prismaMock from "@calcom/testing/lib/__mocks__/prisma";
import {
addWorkflowReminders,
createBookingScenario,
getDate,
getMockBookingAttendee,
getScenarioData,
TestData,
} from "@calcom/testing/lib/bookingScenario/bookingScenario";
import { getBookingEventHandlerService } from "@calcom/features/bookings/di/BookingEventHandlerService.container";
import { BookingRepository } from "@calcom/features/bookings/repositories/BookingRepository";
import { BookingStatus, SchedulingType, WorkflowMethods } from "@calcom/prisma/enums";
import {
expectBookingToBeInDatabase,
expectSuccessfulRoundRobinReschedulingEmails,
expectWorkflowToBeTriggered,
} from "@calcom/testing/lib/bookingScenario/expects";
import { setupAndTeardown } from "@calcom/testing/lib/bookingScenario/setupAndTeardown";
import { test } from "@calcom/testing/lib/fixtures/fixtures";
import { parse } from "node-html-parser";
import { v4 as uuidv4 } from "uuid";
import { beforeEach, describe, expect, vi } from "vitest";
import type { BookingEventHandlerService } from "../../bookings/lib/onBookingEvents/BookingEventHandlerService";
vi.mock("@calcom/features/bookings/lib/EventManager");
vi.mock("@calcom/features/bookings/di/BookingEventHandlerService.container", () => ({
getBookingEventHandlerService: vi.fn(),
}));
const testDestinationCalendar = {
integration: "test-calendar",
externalId: "test-calendar",
};
const testUsers = [
{
id: 1,
name: "user-1",
timeZone: "Asia/Kolkata",
username: "host-1",
email: "host1@test.com",
schedules: [TestData.schedules.IstWorkHours],
destinationCalendar: testDestinationCalendar,
uuid: "uuid-1",
},
{
id: 2,
name: "user-2",
timeZone: "Asia/Kolkata",
username: "host-2",
email: "host2@test.com",
schedules: [TestData.schedules.IstWorkHours],
uuid: "uuid-2",
},
{
id: 3,
name: "user-3",
timeZone: "Asia/Kolkata",
username: "host-3",
email: "host3@test.com",
schedules: [TestData.schedules.IstWorkHours],
uuid: "uuid-3",
},
];
describe("roundRobinReassignment test", () => {
setupAndTeardown();
beforeEach(() => {
// Set up default mock for BookingEventHandlerService
const mockOnReassignment = vi.fn().mockResolvedValue(undefined);
vi.mocked(getBookingEventHandlerService).mockReturnValue({
onReassignment: mockOnReassignment,
} as unknown as BookingEventHandlerService);
});
test("reassign new round robin organizer", async ({ emails }) => {
const roundRobinReassignment = (await import("./roundRobinReassignment")).default;
const EventManager = (await import("@calcom/features/bookings/lib/EventManager")).default;
const eventManagerSpy = vi.spyOn(EventManager.prototype as any, "reschedule");
// Clear any existing mock calls from previous tests
eventManagerSpy.mockClear();
eventManagerSpy.mockResolvedValue({ referencesToCreate: [] });
const users = testUsers;
const originalHost = users[0];
const newHost = users[1];
// Assume we are using the RR fairness algorithm. Add an extra booking for user[2] to ensure user[1] is the new host
const { dateString: dateStringPlusOne } = getDate({ dateIncrement: 1 });
const { dateString: dateStringMinusOne } = getDate({ dateIncrement: -1 });
const { dateString: dateStringPlusTwo } = getDate({ dateIncrement: 2 });
const bookingToReassignUid = "booking-to-reassign";
const bookingData = await createBookingScenario(
getScenarioData({
workflows: [
{
userId: originalHost.id,
trigger: "NEW_EVENT",
action: "EMAIL_HOST",
template: "REMINDER",
activeEventTypeId: 1,
},
],
eventTypes: [
{
id: 1,
slug: "round-robin-event",
schedulingType: SchedulingType.ROUND_ROBIN,
length: 45,
users: users.map((user) => {
return {
id: user.id,
};
}),
hosts: users.map((user) => {
return {
userId: user.id,
isFixed: false,
};
}),
},
],
bookings: [
{
id: 123,
eventTypeId: 1,
userId: originalHost.id,
uid: bookingToReassignUid,
status: BookingStatus.ACCEPTED,
startTime: `${dateStringPlusOne}T05:00:00.000Z`,
endTime: `${dateStringPlusOne}T05:15:00.000Z`,
attendees: [
getMockBookingAttendee({
id: 2,
name: "attendee",
email: "attendee@test.com",
locale: "en",
timeZone: "Asia/Kolkata",
}),
],
},
{
id: 456,
eventTypeId: 1,
userId: users[2].id,
uid: bookingToReassignUid,
status: BookingStatus.ACCEPTED,
startTime: `${dateStringMinusOne}T05:00:00.000Z`,
endTime: `${dateStringMinusOne}T05:15:00.000Z`,
attendees: [
getMockBookingAttendee({
id: 2,
name: "attendee",
email: "attendee@test.com",
locale: "en",
timeZone: "Asia/Kolkata",
}),
],
},
],
organizer: originalHost,
usersApartFromOrganizer: users.slice(1),
})
);
await addWorkflowReminders([
{
bookingUid: bookingToReassignUid,
method: WorkflowMethods.EMAIL,
scheduledDate: dateStringPlusTwo,
scheduled: true,
workflowStepId: 1,
workflowId: 1,
},
]);
await roundRobinReassignment({
bookingId: 123,
orgId: null,
reassignedById: originalHost.id,
actionSource: "WEBAPP",
reassignedByUuid: originalHost.uuid,
});
expect(eventManagerSpy).toBeCalledTimes(1);
// Triggers moving to new host within event manager
expect(eventManagerSpy).toHaveBeenCalledWith(
expect.any(Object),
bookingToReassignUid,
undefined,
true,
expect.arrayContaining([expect.objectContaining(testDestinationCalendar)]),
undefined,
true
);
// Use equal fairness rr algorithm
expectBookingToBeInDatabase({
uid: bookingToReassignUid,
userId: newHost.id,
});
expectSuccessfulRoundRobinReschedulingEmails({
prevOrganizer: originalHost,
newOrganizer: newHost,
emails,
});
expectWorkflowToBeTriggered({ emailsToReceive: [newHost.email], emails });
});
// TODO: add fixed hosts test
test("Reassign round robin host with fixed host as organizer", async () => {
const roundRobinReassignment = (await import("./roundRobinReassignment")).default;
const EventManager = (await import("@calcom/features/bookings/lib/EventManager")).default;
const eventManagerSpy = vi.spyOn(EventManager.prototype as any, "reschedule");
// Clear any existing mock calls from previous tests
eventManagerSpy.mockClear();
const users = testUsers;
const bookingToReassignUid = "booking-to-reassign";
const fixedHost = users[0];
const currentRRHost = users[1];
const newHost = users[2];
// Assume we are using the RR fairness algorithm. Add an extra booking for user[2] to ensure user[1] is the new host
const { dateString: dateStringPlusOne } = getDate({ dateIncrement: 1 });
await createBookingScenario(
getScenarioData({
workflows: [
{
userId: fixedHost.id,
trigger: "NEW_EVENT",
action: "EMAIL_HOST",
template: "REMINDER",
activeEventTypeId: 1,
},
],
eventTypes: [
{
id: 1,
slug: "round-robin-event",
schedulingType: SchedulingType.ROUND_ROBIN,
length: 45,
users: users.map((user) => {
return {
id: user.id,
};
}),
hosts: users.map((user) => {
return {
userId: user.id,
isFixed: !!(user.id === fixedHost.id),
};
}),
},
],
bookings: [
{
id: 123,
eventTypeId: 1,
userId: fixedHost.id,
uid: bookingToReassignUid,
status: BookingStatus.ACCEPTED,
startTime: `${dateStringPlusOne}T05:00:00.000Z`,
endTime: `${dateStringPlusOne}T05:15:00.000Z`,
attendees: [
getMockBookingAttendee({
id: 1,
name: "attendee",
email: "attendee@test.com",
locale: "en",
timeZone: "Asia/Kolkata",
}),
getMockBookingAttendee({
id: currentRRHost.id,
name: currentRRHost.name,
email: currentRRHost.email,
locale: "en",
timeZone: currentRRHost.timeZone,
}),
],
},
],
organizer: fixedHost,
usersApartFromOrganizer: users.slice(1),
})
);
await roundRobinReassignment({
bookingId: 123,
orgId: null,
reassignedById: fixedHost.id,
});
expect(eventManagerSpy).toBeCalledTimes(1);
// Triggers moving to new host within event manager
expect(eventManagerSpy).toHaveBeenCalledWith(
expect.any(Object),
bookingToReassignUid,
undefined,
false,
[],
undefined,
false
);
// Ensure organizer stays the same
expectBookingToBeInDatabase({
uid: bookingToReassignUid,
userId: 1,
});
const bookingRepo = new BookingRepository(prismaMock);
const attendees = await bookingRepo.getBookingAttendees(123);
expect(attendees.some((attendee) => attendee.email === currentRRHost.email)).toBe(false);
expect(attendees.some((attendee) => attendee.email === newHost.email)).toBe(true);
});
test("should not expose other attendees in updated email when seatsShowAttendees is disabled for seated round-robin event", async ({
emails,
}) => {
const roundRobinReassignment = (await import("./roundRobinReassignment")).default;
const EventManager = (await import("@calcom/features/bookings/lib/EventManager")).default;
const eventManagerSpy = vi.spyOn(EventManager.prototype as any, "reschedule");
eventManagerSpy.mockClear();
eventManagerSpy.mockResolvedValue({ referencesToCreate: [] });
const users = testUsers;
const originalHost = users[0];
const newHost = users[1];
const { dateString: dateStringPlusOne } = getDate({ dateIncrement: 1 });
const { dateString: dateStringMinusOne } = getDate({ dateIncrement: -1 });
const bookingToReassignUid = "seated-booking-to-reassign";
const attendee1Email = "attendee1@test.com";
const attendee2Email = "attendee2@test.com";
const attendee3Email = "attendee3@test.com";
await createBookingScenario(
getScenarioData({
eventTypes: [
{
id: 1,
slug: "round-robin-seated-event",
schedulingType: SchedulingType.ROUND_ROBIN,
length: 45,
seatsPerTimeSlot: 5,
seatsShowAttendees: false,
users: users.map((user) => ({ id: user.id })),
hosts: users.map((user) => ({ userId: user.id, isFixed: false })),
},
],
bookings: [
{
id: 123,
eventTypeId: 1,
userId: originalHost.id,
uid: bookingToReassignUid,
status: BookingStatus.ACCEPTED,
startTime: `${dateStringPlusOne}T05:00:00.000Z`,
endTime: `${dateStringPlusOne}T05:15:00.000Z`,
attendees: [
{
...getMockBookingAttendee({
id: 2,
name: "Attendee 1",
email: attendee1Email,
locale: "en",
timeZone: "Asia/Kolkata",
}),
bookingSeat: {
referenceUid: uuidv4(),
data: {},
},
},
{
...getMockBookingAttendee({
id: 3,
name: "Attendee 2",
email: attendee2Email,
locale: "en",
timeZone: "Asia/Kolkata",
}),
bookingSeat: {
referenceUid: uuidv4(),
data: {},
},
},
{
...getMockBookingAttendee({
id: 4,
name: "Attendee 3",
email: attendee3Email,
locale: "en",
timeZone: "Asia/Kolkata",
}),
bookingSeat: {
referenceUid: uuidv4(),
data: {},
},
},
],
},
{
id: 456,
eventTypeId: 1,
userId: users[2].id,
uid: "other-booking",
status: BookingStatus.ACCEPTED,
startTime: `${dateStringMinusOne}T05:00:00.000Z`,
endTime: `${dateStringMinusOne}T05:15:00.000Z`,
attendees: [
getMockBookingAttendee({
id: 5,
name: "attendee",
email: "attendee@test.com",
locale: "en",
timeZone: "Asia/Kolkata",
}),
],
},
],
organizer: originalHost,
usersApartFromOrganizer: users.slice(1),
})
);
await roundRobinReassignment({
bookingId: 123,
orgId: null,
reassignedById: originalHost.id,
actionSource: "WEBAPP",
reassignedByUuid: originalHost.uuid,
});
expect(eventManagerSpy).toBeCalledTimes(1);
// Verify that updated emails were sent to all attendees
const updatedEmails = emails.get().filter((email) => {
const subject = email.subject || "";
return subject.includes("updated") || subject.includes("event_type_has_been_updated");
});
// Check that each attendee received an email
expect(updatedEmails.some((email) => email.to.includes(attendee1Email))).toBe(true);
expect(updatedEmails.some((email) => email.to.includes(attendee2Email))).toBe(true);
expect(updatedEmails.some((email) => email.to.includes(attendee3Email))).toBe(true);
// Verify that each attendee's email does not contain other attendees' information
const attendee1EmailContent = updatedEmails.find((email) => email.to.includes(attendee1Email));
if (attendee1EmailContent) {
const emailHtml = parse(attendee1EmailContent.html);
const emailText = emailHtml.innerText;
// Should not contain other attendees' emails or names
expect(emailText).not.toContain(attendee2Email);
expect(emailText).not.toContain(attendee3Email);
expect(emailText).not.toContain("Attendee 2");
expect(emailText).not.toContain("Attendee 3");
// Should contain their own info
expect(emailText).toContain("Attendee 1");
}
const attendee2EmailContent = updatedEmails.find((email) => email.to.includes(attendee2Email));
if (attendee2EmailContent) {
const emailHtml = parse(attendee2EmailContent.html);
const emailText = emailHtml.innerText;
// Should not contain other attendees' emails or names
expect(emailText).not.toContain(attendee1Email);
expect(emailText).not.toContain(attendee3Email);
expect(emailText).not.toContain("Attendee 1");
expect(emailText).not.toContain("Attendee 3");
// Should contain their own info
expect(emailText).toContain("Attendee 2");
}
const attendee3EmailContent = updatedEmails.find((email) => email.to.includes(attendee3Email));
if (attendee3EmailContent) {
const emailHtml = parse(attendee3EmailContent.html);
const emailText = emailHtml.innerText;
// Should not contain other attendees' emails or names
expect(emailText).not.toContain(attendee1Email);
expect(emailText).not.toContain(attendee2Email);
expect(emailText).not.toContain("Attendee 1");
expect(emailText).not.toContain("Attendee 2");
// Should contain their own info
expect(emailText).toContain("Attendee 3");
}
});
});
describe("roundRobinReassignment - Audit Data Verification", () => {
setupAndTeardown();
test("should call BookingEventHandlerService.onReassignment with correct audit data when organizer changes", async () => {
const roundRobinReassignment = (await import("./roundRobinReassignment")).default;
const EventManager = (await import("@calcom/features/bookings/lib/EventManager")).default;
const eventManagerSpy = vi.spyOn(EventManager.prototype as any, "reschedule");
eventManagerSpy.mockClear();
eventManagerSpy.mockResolvedValue({ referencesToCreate: [] });
const mockOnReassignment = vi.fn().mockResolvedValue(undefined);
vi.mocked(getBookingEventHandlerService).mockReturnValue({
onReassignment: mockOnReassignment,
} as any);
const users = testUsers;
const originalHost = users[0];
const newHost = users[1];
const reassigningUser = users[0]; // originalHost is doing the reassignment
const { dateString: dateStringPlusOne } = getDate({ dateIncrement: 1 });
const { dateString: dateStringMinusOne } = getDate({ dateIncrement: -1 });
const { dateString: dateStringPlusTwo } = getDate({ dateIncrement: 2 });
const bookingToReassignUid = "booking-audit-test";
await createBookingScenario(
getScenarioData({
eventTypes: [
{
id: 1,
slug: "round-robin-event",
schedulingType: SchedulingType.ROUND_ROBIN,
length: 45,
users: users.map((user) => ({ id: user.id })),
hosts: users.map((user) => ({ userId: user.id, isFixed: false })),
},
],
bookings: [
{
id: 123,
eventTypeId: 1,
userId: originalHost.id,
uid: bookingToReassignUid,
status: BookingStatus.ACCEPTED,
startTime: `${dateStringPlusOne}T05:00:00.000Z`,
endTime: `${dateStringPlusOne}T05:15:00.000Z`,
attendees: [
getMockBookingAttendee({
id: 2,
name: "attendee",
email: "attendee@test.com",
locale: "en",
timeZone: "Asia/Kolkata",
}),
],
},
{
id: 456,
eventTypeId: 1,
userId: users[2].id,
uid: "other-booking",
status: BookingStatus.ACCEPTED,
startTime: `${dateStringMinusOne}T05:00:00.000Z`,
endTime: `${dateStringMinusOne}T05:15:00.000Z`,
attendees: [
getMockBookingAttendee({
id: 2,
name: "attendee",
email: "attendee@test.com",
locale: "en",
timeZone: "Asia/Kolkata",
}),
],
},
],
organizer: originalHost,
usersApartFromOrganizer: users.slice(1),
})
);
await roundRobinReassignment({
bookingId: 123,
orgId: null,
reassignedById: reassigningUser.id,
actionSource: "WEBAPP",
reassignedByUuid: reassigningUser.uuid,
});
expect(mockOnReassignment).toHaveBeenCalledTimes(1);
expect(mockOnReassignment).toHaveBeenCalledWith({
bookingUid: bookingToReassignUid,
actor: { identifiedBy: "user", userUuid: reassigningUser.uuid },
organizationId: null,
source: "WEBAPP",
auditData: {
organizerUuid: { old: originalHost.uuid, new: newHost.uuid },
reassignmentReason: null,
reassignmentType: "roundRobin",
},
});
});
test("should call BookingEventHandlerService.onReassignment with correct audit data when only attendee changes (fixed host scenario)", async () => {
const roundRobinReassignment = (await import("./roundRobinReassignment")).default;
const EventManager = (await import("@calcom/features/bookings/lib/EventManager")).default;
const eventManagerSpy = vi.spyOn(EventManager.prototype as any, "reschedule");
eventManagerSpy.mockClear();
eventManagerSpy.mockResolvedValue({ referencesToCreate: [] });
const mockOnReassignment = vi.fn().mockResolvedValue(undefined);
vi.mocked(getBookingEventHandlerService).mockReturnValue({
onReassignment: mockOnReassignment,
} as any);
const users = testUsers;
const fixedHost = users[0];
const currentRRHost = users[1];
const newHost = users[2];
const reassigningUser = fixedHost;
const { dateString: dateStringPlusOne } = getDate({ dateIncrement: 1 });
const bookingToReassignUid = "booking-audit-fixed-host-test";
await createBookingScenario(
getScenarioData({
eventTypes: [
{
id: 1,
slug: "round-robin-event",
schedulingType: SchedulingType.ROUND_ROBIN,
length: 45,
users: users.map((user) => ({ id: user.id })),
hosts: users.map((user) => ({
userId: user.id,
isFixed: user.id === fixedHost.id,
})),
},
],
bookings: [
{
id: 123,
eventTypeId: 1,
userId: fixedHost.id,
uid: bookingToReassignUid,
status: BookingStatus.ACCEPTED,
startTime: `${dateStringPlusOne}T05:00:00.000Z`,
endTime: `${dateStringPlusOne}T05:15:00.000Z`,
attendees: [
getMockBookingAttendee({
id: 1,
name: "attendee",
email: "attendee@test.com",
locale: "en",
timeZone: "Asia/Kolkata",
}),
getMockBookingAttendee({
id: currentRRHost.id,
name: currentRRHost.name,
email: currentRRHost.email,
locale: "en",
timeZone: currentRRHost.timeZone,
}),
],
},
],
organizer: fixedHost,
usersApartFromOrganizer: users.slice(1),
})
);
await roundRobinReassignment({
bookingId: 123,
orgId: null,
reassignedById: reassigningUser.id,
actionSource: "WEBAPP",
reassignedByUuid: reassigningUser.uuid,
});
expect(mockOnReassignment).toHaveBeenCalledTimes(1);
const callArgs = mockOnReassignment.mock.calls[0][0];
expect(callArgs.bookingUid).toBe(bookingToReassignUid);
expect(callArgs.actor).toEqual({ identifiedBy: "user", userUuid: reassigningUser.uuid });
expect(callArgs.organizationId).toBe(null);
expect(callArgs.source).toBe("WEBAPP");
// organizerUuid should NOT be included when organizer hasn't changed (fixed host scenario)
expect(callArgs.auditData.organizerUuid).toBeUndefined();
expect(callArgs.auditData.reassignmentType).toBe("roundRobin");
expect(callArgs.auditData.reassignmentReason).toBe(null);
expect(callArgs.auditData.hostAttendeeUpdated).toBeDefined();
expect(callArgs.auditData.hostAttendeeUpdated?.withUserUuid).toEqual({
old: currentRRHost.uuid,
new: newHost.uuid,
});
});
});