mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
test CallReconnecting event
This commit is contained in:
@@ -192,4 +192,45 @@ describe("CallEnded", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("CallReconnecting", () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
mockConfig();
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
vi.restoreAllMocks();
|
||||||
|
vi.spyOn(PosthogAnalytics.instance, "trackEvent").mockImplementation(
|
||||||
|
() => {},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
PosthogAnalytics.resetInstance();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("tracks event with correct shape", () => {
|
||||||
|
const tracker = new CallReconnectingTracker();
|
||||||
|
tracker.track("!room:example.org", "syncing");
|
||||||
|
|
||||||
|
expect(PosthogAnalytics.instance.trackEvent).toHaveBeenCalledWith({
|
||||||
|
eventName: "CallReconnecting",
|
||||||
|
callId: "!room:example.org",
|
||||||
|
reason: "syncing",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it.each([
|
||||||
|
"syncing",
|
||||||
|
"membershipConnected",
|
||||||
|
"certainlyConnected",
|
||||||
|
"livekit",
|
||||||
|
] as CallReconnectingReason[])("tracks reason %s correctly", (reason) => {
|
||||||
|
const tracker = new CallReconnectingTracker();
|
||||||
|
tracker.track("!room:example.org", reason);
|
||||||
|
|
||||||
|
expect(PosthogAnalytics.instance.trackEvent).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({ reason }),
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user