Support build-time specified protocol scheme for oidc callback (#29814)

* Support build-time specified protocol scheme for oidc callback

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Add tests

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski
2025-05-22 11:24:53 +01:00
committed by GitHub
parent bd142412e5
commit f5125ac2b8
3 changed files with 40 additions and 10 deletions

View File

@@ -31,6 +31,11 @@ describe("ElectronPlatform", () => {
const mockElectron = {
on: jest.fn(),
send: jest.fn(),
initialise: jest.fn().mockResolvedValue({
protocol: "io.element.desktop",
sessionId: "session-id",
config: { _config: true },
}),
};
const dispatchSpy = jest.spyOn(dispatcher, "dispatch");
@@ -64,6 +69,17 @@ describe("ElectronPlatform", () => {
expect(rageshake.flush).toHaveBeenCalled();
});
it("should load config", async () => {
const platform = new ElectronPlatform();
await expect(platform.getConfig()).resolves.toEqual({ _config: true });
});
it("should return oidc client state as expected", async () => {
const platform = new ElectronPlatform();
await platform.getConfig();
expect(platform.getOidcClientState()).toMatchInlineSnapshot(`":element-desktop-ssoid:session-id"`);
});
it("dispatches view settings action on preferences event", () => {
new ElectronPlatform();
const [event, handler] = getElectronEventHandlerCall("preferences")!;
@@ -287,7 +303,7 @@ describe("ElectronPlatform", () => {
});
});
describe("breacrumbs", () => {
describe("breadcrumbs", () => {
it("should send breadcrumb updates over the IPC", () => {
const spy = jest.spyOn(BreadcrumbsStore.instance, "on");
new ElectronPlatform();