mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-22 06:42:19 +03:00
test(dashboard): reactivate API endpoints coverage (#13841)
Co-authored-by: Paco Cartones <pacocartones@users.noreply.github.com>
This commit is contained in:
@@ -20,12 +20,6 @@
|
||||
"measured": "2026-09-10",
|
||||
"status": "Tests 3 failed | 1 passed (4)"
|
||||
},
|
||||
{
|
||||
"file": "src/app/(dashboard)/dashboard/endpoint/__tests__/ApiEndpointsTab.test.tsx",
|
||||
"issue": "#13204",
|
||||
"measured": "2026-09-10",
|
||||
"status": "Tests 2 failed | 1 passed (3)"
|
||||
},
|
||||
{
|
||||
"file": "src/app/(dashboard)/dashboard/cache/__tests__/CacheTrends.test.tsx",
|
||||
"issue": "#13204",
|
||||
|
||||
@@ -17,6 +17,7 @@ vi.mock("next-intl", () => ({
|
||||
useTranslations: (namespace?: string) => {
|
||||
const messages: Record<string, string> = {
|
||||
"endpoint.apiEndpointsCatalogUnavailable": "API catalog unavailable",
|
||||
"endpoint.catalogStats": "{endpoints} endpoints across {categories} categories",
|
||||
"endpoint.apiEndpointsSearchPlaceholder": "Search endpoints",
|
||||
"endpoint.badgeLoopbackTooltip": "Loopback only",
|
||||
"endpoint.badgeAlwaysProtectedTooltip": "Always protected",
|
||||
@@ -53,10 +54,17 @@ vi.mock("next-intl", () => ({
|
||||
"endpoint.execute": "Execute",
|
||||
"endpoint.executing": "Executing",
|
||||
"endpoint.close": "Close",
|
||||
"endpoint.example": "Example",
|
||||
"endpoint.openJsonResponse": "Open JSON response",
|
||||
};
|
||||
|
||||
return (key: string) => messages[`${namespace}.${key}`] || key;
|
||||
return (key: string, values?: Record<string, string | number>) => {
|
||||
const template = messages[`${namespace}.${key}`] || key;
|
||||
return Object.entries(values || {}).reduce(
|
||||
(text, [name, value]) => text.replace(`{${name}}`, String(value)),
|
||||
template
|
||||
);
|
||||
};
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -173,6 +181,8 @@ describe("ApiEndpointsTab", () => {
|
||||
|
||||
await waitForText("VS Code Token Alias");
|
||||
await waitForText("OmniRoute API");
|
||||
await waitForText("1 endpoints across 1 categories");
|
||||
await waitForText("/api/v1/vscode/sk-live-123/models");
|
||||
expect(document.body.textContent).toContain("1 endpoints across 1 categories");
|
||||
expect(document.body.textContent).toContain("/api/v1/vscode/sk-live-123/models");
|
||||
expect(document.body.textContent).toContain("/api/v1/chat/completions");
|
||||
@@ -209,16 +219,16 @@ describe("ApiEndpointsTab", () => {
|
||||
renderApiEndpointsTab();
|
||||
|
||||
await waitForText("OmniRoute API");
|
||||
await waitForText("1 endpoints across 1 categories");
|
||||
|
||||
// Expand the endpoint to reveal the curl example
|
||||
const endpointRow = Array.from(document.body.querySelectorAll("code")).find((node) =>
|
||||
node.textContent?.includes("/api/v1/chat/completions")
|
||||
const endpointRow = Array.from(document.body.querySelectorAll("code")).find(
|
||||
(node) => node.textContent?.trim() === "/api/v1/chat/completions"
|
||||
);
|
||||
if (endpointRow?.parentElement) {
|
||||
await act(async () => {
|
||||
endpointRow.parentElement!.click();
|
||||
});
|
||||
}
|
||||
expect(endpointRow).toBeTruthy();
|
||||
act(() => {
|
||||
endpointRow!.parentElement!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
|
||||
});
|
||||
|
||||
await waitForText("curl -X POST");
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ export default defineConfig({
|
||||
"tests/unit/ui/request-logger-autorefresh-visibility-3972.test.tsx", // #13204 — falha real; remover esta exclusão quando consertado
|
||||
"tests/unit/ui/logs-page-detail-modal-reopen-on-close.test.tsx", // #13204 — falha real; remover esta exclusão quando consertado
|
||||
"tests/unit/ui/agent-card.test.tsx", // #13204 — falha real; remover esta exclusão quando consertado
|
||||
"src/app/(dashboard)/dashboard/endpoint/__tests__/ApiEndpointsTab.test.tsx", // #13204 — falha real; remover esta exclusão quando consertado
|
||||
"src/app/(dashboard)/dashboard/cache/__tests__/CacheTrends.test.tsx", // #13204 — falha real; remover esta exclusão quando consertado
|
||||
"src/app/(dashboard)/dashboard/cache/__tests__/IdempotencyLayer.test.tsx", // #13204 — falha real; remover esta exclusão quando consertado
|
||||
"src/app/(dashboard)/dashboard/cache/__tests__/CachePerformance.test.tsx", // #13204 — falha real; remover esta exclusão quando consertado
|
||||
|
||||
Reference in New Issue
Block a user