import auth from "./auth"; const testAuthURL = (url, endpoint) => { const u = new URL(url); const path = u.pathname.split("/"); expect(u.protocol).toMatch(/^http/); expect(u.host).toBeTruthy(); expect(path[path.length - 1]).toEqual(endpoint); expect(u.searchParams.get("redirect")).toBeTruthy(); }; describe("Auth service", () => { describe("Auth URLs", () => { it("Authorize URL", () => { testAuthURL(auth.ssoAuthorize(), "authorize"); }); it("Logout URL", () => { testAuthURL(auth.ssoLogout(), "logout"); }); }); });