1
0
forked from baron/baron-sso

75f192fb24 기준 병합 code-check 수정

This commit is contained in:
2026-06-02 11:46:40 +09:00
parent 38605ac8a3
commit 2c5eed1774
17 changed files with 276 additions and 188 deletions

View File

@@ -32,8 +32,9 @@ describe("apiClient", () => {
beforeEach(() => {
vi.resetModules();
vi.stubEnv("MODE", "test");
(window as Window & typeof globalThis & { _IS_TEST_MODE?: boolean })._IS_TEST_MODE =
true;
(
window as Window & typeof globalThis & { _IS_TEST_MODE?: boolean }
)._IS_TEST_MODE = true;
window.localStorage.clear();
getUserMock.mockResolvedValue(null);
findPersistedOidcUserMock.mockReturnValue(undefined);
@@ -47,7 +48,8 @@ describe("apiClient", () => {
window.localStorage.setItem("dev_tenant_id", "tenant-1");
const { default: apiClient } = await import("./apiClient");
const requestHandler = apiClient.interceptors.request.handlers[0]?.fulfilled;
const requestHandler =
apiClient.interceptors.request.handlers[0]?.fulfilled;
const result = await requestHandler?.({ headers: {} });
@@ -58,7 +60,8 @@ describe("apiClient", () => {
it("rejects non-auth response errors without redirecting", async () => {
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
const { default: apiClient } = await import("./apiClient");
const responseHandler = apiClient.interceptors.response.handlers[0]?.rejected;
const responseHandler =
apiClient.interceptors.response.handlers[0]?.rejected;
const error = { response: { status: 500, data: { error: "boom" } } };
await expect(responseHandler?.(error)).rejects.toBe(error);
@@ -69,7 +72,8 @@ describe("apiClient", () => {
it("warns and rejects auth failures in test mode", async () => {
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {});
const { default: apiClient } = await import("./apiClient");
const responseHandler = apiClient.interceptors.response.handlers[0]?.rejected;
const responseHandler =
apiClient.interceptors.response.handlers[0]?.rejected;
const error = {
response: {
status: 403,