chore: ran linting

This commit is contained in:
Anish Sarkar 2026-05-09 05:16:20 +05:30
parent 2f540ee065
commit dbf575fbd0
23 changed files with 89 additions and 96 deletions

View file

@ -9,8 +9,7 @@ import type { APIRequestContext } from "@playwright/test";
* is set up separately by tests/auth.setup.ts.
*/
export const BACKEND_URL =
process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL || "http://localhost:8000";
export const BACKEND_URL = process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL || "http://localhost:8000";
const TEST_USER_EMAIL = process.env.PLAYWRIGHT_TEST_EMAIL || "test@surfsense.net";
const TEST_USER_PASSWORD = process.env.PLAYWRIGHT_TEST_PASSWORD || "TestPassword123!";
@ -43,10 +42,7 @@ export async function loginAsTestUser(request: APIRequestContext): Promise<strin
* X-E2E-Scenario header that the test-only ScenarioMiddleware in
* surfsense_backend/tests/e2e/run_backend.py reads to flip fake behavior.
*/
export function authHeaders(
token: string,
extra?: Record<string, string>
): Record<string, string> {
export function authHeaders(token: string, extra?: Record<string, string>): Record<string, string> {
return {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",

View file

@ -25,17 +25,14 @@ export async function listDocuments(
{ headers: authHeaders(token) }
);
if (!response.ok()) {
throw new Error(
`listDocuments failed (${response.status()}): ${await response.text()}`
);
throw new Error(`listDocuments failed (${response.status()}): ${await response.text()}`);
}
const body = (await response.json()) as Paginated<DocumentRow> | DocumentRow[];
return Array.isArray(body) ? body : (body.items ?? []);
}
export function isDocumentReady(doc: DocumentRow): boolean {
const state =
typeof doc.status === "string" ? doc.status : doc.status?.state;
const state = typeof doc.status === "string" ? doc.status : doc.status?.state;
return state === "ready" || state === "READY";
}
@ -61,9 +58,7 @@ export async function getEditorContent(
{ headers: authHeaders(token) }
);
if (!response.ok()) {
throw new Error(
`getEditorContent failed (${response.status()}): ${await response.text()}`
);
throw new Error(`getEditorContent failed (${response.status()}): ${await response.text()}`);
}
return (await response.json()) as EditorContent;
}

View file

@ -18,9 +18,7 @@ export async function createSearchSpace(
data: { name, description },
});
if (!response.ok()) {
throw new Error(
`createSearchSpace failed (${response.status()}): ${await response.text()}`
);
throw new Error(`createSearchSpace failed (${response.status()}): ${await response.text()}`);
}
return (await response.json()) as SearchSpaceRow;
}