This commit is contained in:
Valere
2025-10-27 15:59:01 +01:00
parent 3ecffccd9e
commit 0309ceb6aa
2 changed files with 6 additions and 4 deletions

View File

@@ -295,11 +295,12 @@ test("Should not close widget when auto leave due to error", async () => {
const user = userEvent.setup(); const user = userEvent.setup();
const widgetStopMock = vi.fn().mockResolvedValue(undefined); const widgetStopMock = vi.fn().mockResolvedValue(undefined);
const widgetSendMock = vi.fn().mockResolvedValue(undefined);
const widget = { const widget = {
api: { api: {
setAlwaysOnScreen: vi.fn().mockResolvedValue(true), setAlwaysOnScreen: vi.fn().mockResolvedValue(true),
transport: { transport: {
send: vi.fn().mockResolvedValue(undefined), send: widgetSendMock,
reply: vi.fn().mockResolvedValue(undefined), reply: vi.fn().mockResolvedValue(undefined),
stop: widgetStopMock, stop: widgetStopMock,
} as unknown as ITransport, } as unknown as ITransport,
@@ -308,7 +309,6 @@ test("Should not close widget when auto leave due to error", async () => {
}; };
const alwaysOnScreenSpy = vi.spyOn(widget.api, "setAlwaysOnScreen"); const alwaysOnScreenSpy = vi.spyOn(widget.api, "setAlwaysOnScreen");
const transportSendSpy = vi.spyOn(widget.api.transport, "send");
const { getByText } = createGroupCallView(widget as WidgetHelpers); const { getByText } = createGroupCallView(widget as WidgetHelpers);
const leaveButton = getByText("SimulateErrorLeft"); const leaveButton = getByText("SimulateErrorLeft");
@@ -320,7 +320,7 @@ test("Should not close widget when auto leave due to error", async () => {
await flushPromises(); await flushPromises();
// But then we do not close the widget automatically // But then we do not close the widget automatically
expect(widgetStopMock).not.toHaveBeenCalledOnce(); expect(widgetStopMock).not.toHaveBeenCalledOnce();
expect(transportSendSpy).not.toHaveBeenCalledOnce(); expect(widgetSendMock).not.toHaveBeenCalledOnce();
}); });
test.skip("GroupCallView leaves the session when an error occurs", async () => { test.skip("GroupCallView leaves the session when an error occurs", async () => {

View File

@@ -111,7 +111,9 @@ export interface ActiveCallProps
extends Omit<InCallViewProps, "vm" | "livekitRoom" | "connState"> { extends Omit<InCallViewProps, "vm" | "livekitRoom" | "connState"> {
e2eeSystem: EncryptionSystem; e2eeSystem: EncryptionSystem;
// TODO refactor those reasons into an enum // TODO refactor those reasons into an enum
onLeft: (reason: "user" | "timeout" | "decline" | "allOthersLeft") => void; onLeft: (
reason: "user" | "timeout" | "decline" | "allOthersLeft" | "error",
) => void;
} }
export const ActiveCall: FC<ActiveCallProps> = (props) => { export const ActiveCall: FC<ActiveCallProps> = (props) => {