Self-host compose stack and production stability fixes
这个提交包含在:
29
client/src/const.test.ts
普通文件
29
client/src/const.test.ts
普通文件
@@ -0,0 +1,29 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { getLoginUrl } from "./const";
|
||||
|
||||
describe("getLoginUrl", () => {
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
it("falls back to the in-app login route when oauth portal is unset", () => {
|
||||
vi.stubEnv("VITE_OAUTH_PORTAL_URL", "");
|
||||
|
||||
expect(getLoginUrl()).toBe("/login");
|
||||
});
|
||||
|
||||
it("builds the external oauth login url when portal is configured", () => {
|
||||
vi.stubEnv("VITE_OAUTH_PORTAL_URL", "https://oauth.example.com");
|
||||
vi.stubEnv("VITE_APP_ID", "tennis-training-hub");
|
||||
|
||||
const url = new URL(getLoginUrl());
|
||||
|
||||
expect(url.origin).toBe("https://oauth.example.com");
|
||||
expect(url.pathname).toBe("/app-auth");
|
||||
expect(url.searchParams.get("appId")).toBe("tennis-training-hub");
|
||||
expect(url.searchParams.get("redirectUri")).toBe(
|
||||
`${window.location.origin}/api/oauth/callback`
|
||||
);
|
||||
expect(url.searchParams.get("type")).toBe("signIn");
|
||||
});
|
||||
});
|
||||
在新工单中引用
屏蔽一个用户