mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2026-02-06 18:56:48 +00:00
feat: add frontend test infrastructure and fix CI workflow
- Fix pnpm version mismatch in test_next_server.yml (8 → auto-detect 10) - Add concurrency group to cancel stale CI runs - Remove redundant setup-node step - Update jest.config.js for jsdom + tsx support - Add meetingStatusBatcher integration test (3 tests) - Extract createMeetingStatusBatcher factory for testability
This commit is contained in:
@@ -8,18 +8,24 @@ type MeetingStatusResult = {
|
||||
upcoming_events: components["schemas"]["CalendarEventResponse"][];
|
||||
};
|
||||
|
||||
export const meetingStatusBatcher = create({
|
||||
fetcher: async (roomNames: string[]): Promise<MeetingStatusResult[]> => {
|
||||
const unique = [...new Set(roomNames)];
|
||||
const { data } = await client.POST("/v1/rooms/meetings/bulk-status", {
|
||||
body: { room_names: unique },
|
||||
});
|
||||
return roomNames.map((name) => ({
|
||||
roomName: name,
|
||||
active_meetings: data?.[name]?.active_meetings ?? [],
|
||||
upcoming_events: data?.[name]?.upcoming_events ?? [],
|
||||
}));
|
||||
},
|
||||
resolver: keyResolver("roomName"),
|
||||
scheduler: windowScheduler(10),
|
||||
});
|
||||
const BATCH_WINDOW_MS = 10;
|
||||
|
||||
export function createMeetingStatusBatcher(windowMs: number = BATCH_WINDOW_MS) {
|
||||
return create({
|
||||
fetcher: async (roomNames: string[]): Promise<MeetingStatusResult[]> => {
|
||||
const unique = [...new Set(roomNames)];
|
||||
const { data } = await client.POST("/v1/rooms/meetings/bulk-status", {
|
||||
body: { room_names: unique },
|
||||
});
|
||||
return roomNames.map((name) => ({
|
||||
roomName: name,
|
||||
active_meetings: data?.[name]?.active_meetings ?? [],
|
||||
upcoming_events: data?.[name]?.upcoming_events ?? [],
|
||||
}));
|
||||
},
|
||||
resolver: keyResolver("roomName"),
|
||||
scheduler: windowScheduler(windowMs),
|
||||
});
|
||||
}
|
||||
|
||||
export const meetingStatusBatcher = createMeetingStatusBatcher();
|
||||
|
||||
Reference in New Issue
Block a user