mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-29 03:12:10 +03:00
v3.8.40 cycle integration → main. All test gates green (Unit/Integration/Coverage/Node-compat/Quality-Ratchet). The only red check, 'PR Test Policy', is the test-masking heuristic firing on the cumulative ~57-commit release diff (legitimate assert consolidations already reviewed per-PR — Gemini CLI removal #5246, retired GPT models #5280, provider catalog refreshes); overridden with --admin per the documented release-PR convention. CodeQL/SonarQube advisory scans non-blocking; #5278's code already passed CodeQL on main. Homologated on VPS 192.168.0.15 (v3.8.40 healthy).
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { renderGitDiff } from "../../../open-sse/services/compression/engines/rtk/renderers/gitDiff.ts";
|
|
|
|
const det = {
|
|
type: "git-diff",
|
|
command: "git diff",
|
|
confidence: 1,
|
|
category: "git",
|
|
matchedPatterns: [],
|
|
};
|
|
|
|
test("keeps file headers, hunks and +/- changes; drops context", () => {
|
|
const input = `diff --git a/x.ts b/x.ts
|
|
index 111..222 100644
|
|
--- a/x.ts
|
|
+++ b/x.ts
|
|
@@ -1,3 +1,3 @@
|
|
-const a = 1;
|
|
+const a = 2;
|
|
const b = 3;`;
|
|
const r = renderGitDiff(input, det);
|
|
assert.equal(r.changed, true);
|
|
assert.ok(r.text.includes("diff --git a/x.ts b/x.ts"));
|
|
assert.ok(r.text.includes("@@ -1,3 +1,3 @@"));
|
|
assert.ok(r.text.includes("-const a = 1;"));
|
|
assert.ok(r.text.includes("+const a = 2;"));
|
|
assert.ok(!r.text.includes("index 111..222"));
|
|
assert.ok(!r.text.includes("--- a/x.ts"));
|
|
assert.ok(!r.text.includes(" const b = 3;")); // contexto dropado
|
|
});
|
|
|
|
test("no hunks ⇒ no-op", () => {
|
|
const r = renderGitDiff("just some text\nno diff here", det);
|
|
assert.equal(r.changed, false);
|
|
});
|