Files
OmniRoute/tests/unit/homolog-parity.test.ts
Diego Rodrigues de Sa e Souza c97d2a6ae2 feat(homolog): real-environment E2E homologation suite (npm run homolog) (#7133)
* feat(homolog): scaffolding da suíte de homologação E2E (deps + npm run homolog)

* feat(homolog): L0 avaliador de paridade de deploy (TDD)

* feat(homolog): L1a ciclo de vida de API key efêmera (login admin -> create -> revoke)

* feat(homolog): L1b suite httpYac de API (models, chat, auth de management, health)

* feat(homolog): L1c checker SSE de streaming real (TDD no parser)

* feat(homolog): L2 smoke de providers reais via promptfoo gerado do catálogo

* feat(homolog): L4a Playwright homolog config + login storageState

* feat(homolog): L4b smoke de todas as rotas do dashboard (descoberta via fs)

* feat(homolog): L4c fluxo criar/revogar API key pela UI

* fix(homolog): resiliencia real-environment — stream:false no smoke promptfoo, retry de socket keep-alive, key efemera com sufixo unico

* feat(homolog): L5 orquestrador npm run homolog + relatorio CTRF unificado

* docs(homolog): guia de operacao da suite + fragment de changelog + allowlist env-doc-sync

* fix(homolog): paraleliza o sweep de rotas do dashboard (fullyParallel + 8 workers)

* fix(homolog): isola outputs crus em homolog-report/raw para nao quebrar o ctrf merge

* fix(homolog): outputDir absoluto do reporter CTRF da UI (path relativo escapava do worktree)

* chore(quality): allowlist the 5 homolog-suite devDependencies (ctrf-io trio, httpyac, promptfoo) after registry verification

* chore(quality): register the homolog Playwright suite as a test-discovery collector (run.mjs -> tests/homolog/ui)
2026-07-14 16:24:11 -03:00

30 lines
938 B
TypeScript

import { test } from "node:test";
import assert from "node:assert/strict";
import { evaluateParity } from "../../scripts/homolog/lib/parity.mjs";
test("parity OK quando health bate com a versão esperada", () => {
const r = evaluateParity(
{ status: "healthy", version: "3.8.49" },
{ expectedVersion: "3.8.49", httpStatus: 200 }
);
assert.equal(r.ok, true);
assert.deepEqual(r.failures, []);
});
test("parity falha listando cada divergência", () => {
const r = evaluateParity(
{ status: "degraded", version: "3.8.47" },
{ expectedVersion: "3.8.49", httpStatus: 200 }
);
assert.equal(r.ok, false);
assert.equal(r.failures.length, 2); // status!=healthy, version mismatch
});
test("parity falha em HTTP não-200 mesmo com body bom", () => {
const r = evaluateParity(
{ status: "healthy", version: "3.8.49" },
{ expectedVersion: "3.8.49", httpStatus: 503 }
);
assert.equal(r.ok, false);
});