fix(web): import App.tsx (not App.js) in App.test.tsx #137
@@ -134,7 +134,10 @@ function AdminLayout() {
|
|||||||
export function App() {
|
export function App() {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const [authDisabled, setAuthDisabled] = useState<boolean | null>(null);
|
const [authDisabled, setAuthDisabled] = useState<boolean | null>(null);
|
||||||
const { data: session, isPending: sessionLoading } = useSession();
|
const { data: rawSession, isPending: rawSessionLoading } = useSession();
|
||||||
|
// In dev mode (authDisabled=true), session state is irrelevant - skip useSession result
|
||||||
|
const session = authDisabled ? null : rawSession;
|
||||||
|
const sessionLoading = authDisabled ? false : rawSessionLoading;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetch("/api/dev/config")
|
fetch("/api/dev/config")
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||||
import { render, screen, within, waitFor } from "@testing-library/react";
|
import { render, screen, within, waitFor } from "@testing-library/react";
|
||||||
import { MemoryRouter } from "react-router-dom";
|
import { MemoryRouter } from "react-router-dom";
|
||||||
import { App } from "../App.js";
|
import { App } from "../App";
|
||||||
|
|
||||||
|
|
||||||
// Mock fetch to return appropriate responses based on URL
|
// Mock fetch to return appropriate responses based on URL
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -150,6 +151,12 @@ describe("Dev login selector", () => {
|
|||||||
}),
|
}),
|
||||||
} as Response);
|
} as Response);
|
||||||
}
|
}
|
||||||
|
if (url === "/api/auth/get-session") {
|
||||||
|
return Promise.resolve({
|
||||||
|
ok: true,
|
||||||
|
json: async () => ({ user: null }),
|
||||||
|
} as Response);
|
||||||
|
}
|
||||||
return Promise.resolve({ ok: true, json: async () => [] } as Response);
|
return Promise.resolve({ ok: true, json: async () => [] } as Response);
|
||||||
}) as unknown as typeof fetch;
|
}) as unknown as typeof fetch;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user