forked from r.muellner/velum-raycast
fix: reconcile unchanged document hits after API conflict
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { expect, it } from "bun:test";
|
||||
import {
|
||||
canonicalPerson, filenameScanText, groupReviewHits, makeTextBatches, mappingForSelection, mergePeople,
|
||||
canonicalPerson, filenameScanText, groupReviewHits, makeTextBatches, mappingForSelection, mergePeople, reconcileDocumentHitIds,
|
||||
spansBySegment, withoutPlaceholderHits, withoutWhitelistedHits, withoutWhitelistedRules,
|
||||
} from "../src/lib/project-review";
|
||||
|
||||
@@ -45,6 +45,19 @@ it("zeigt gleiche Zuordnungen einmal mit der Anzahl ihrer Vorkommen", () => {
|
||||
expect(groups.find((group) => group.placeholder === "PERSON_01")?.hits.map((hit) => hit.id)).toEqual(["a", "b"]);
|
||||
});
|
||||
|
||||
it("ordnet bestätigte Dokumenttreffer nach einem 409 nur bei identischem Vorkommen neu zu", () => {
|
||||
const hit = { id: "alt", source: "Absatz 1", start: 4, end: 7, type: "PERSON",
|
||||
original: "Max", context: "Herr Max antwortet" };
|
||||
expect(reconcileDocumentHitIds([hit], ["alt"], [{ ...hit, id: "neu" }])).toEqual(["neu"]);
|
||||
expect(reconcileDocumentHitIds([hit], ["alt"], [{ ...hit, id: "neu", original: "Mia" }])).toBeNull();
|
||||
expect(reconcileDocumentHitIds([hit], ["alt"], [{ ...hit, id: "neu", start: 5 }])).toBeNull();
|
||||
const duplicate = { ...hit, id: "alt2" };
|
||||
expect(reconcileDocumentHitIds([hit, duplicate], ["alt"],
|
||||
[{ ...hit, id: "neu" }, { ...duplicate, id: "neu2" }])).toBeNull();
|
||||
expect(reconcileDocumentHitIds([hit, duplicate], ["alt", "alt2"],
|
||||
[{ ...hit, id: "neu" }, { ...duplicate, id: "neu2" }])).toEqual(["neu", "neu2"]);
|
||||
});
|
||||
|
||||
it("unterdrückt projektweit nur exakt abgewählte Begriffe samt erzwungener Regel", () => {
|
||||
const whitelist = [{ type: "PERSON", original: " Max Muster " }];
|
||||
const hits = [
|
||||
|
||||
Reference in New Issue
Block a user