Files
genshin-assistant/src/lib/scanReviewUtils.test.ts
T
2026-07-09 08:44:50 +02:00

48 lines
1.6 KiB
TypeScript

import { describe, expect, it } from "vitest";
import type { CaptureResult } from "../types/global";
import type { ParsedArtifactCandidate, ParsedField } from "./artifactOcrParser";
import { getAutoReviewReason } from "./scanReviewUtils";
function field(value: string): ParsedField {
return { value, confidence: 95, source: "ocr" };
}
describe("getAutoReviewReason", () => {
it("does not require a detail preview image for clean automatic scan captures", () => {
const capture: CaptureResult = {
id: "window:test",
name: "Genshin",
width: 1920,
height: 1080,
dataUrl: "",
capturedAt: new Date(0).toISOString(),
crops: [{ id: "artifact-name", label: "Artifact name", rect: { x: 0, y: 0, width: 10, height: 10 } }],
ocr: [{ id: "artifact-name", label: "Artifact name", text: "Gladiator's Nostalgia", confidence: 95 }],
};
const parsed: ParsedArtifactCandidate = {
name: "Gladiator's Nostalgia",
slot: "Flower of Life",
level: 20,
mainStat: "HP",
mainValue: "4780",
substats: ["CRIT Rate", "CRIT DMG", "Energy Recharge", "ATK%"],
setName: "Gladiator's Finale",
equipped: "",
confidence: 95,
notes: [],
fields: {
name: field("Gladiator's Nostalgia"),
slot: field("Flower of Life"),
level: field("20"),
mainStat: field("HP"),
mainValue: field("4780"),
setName: field("Gladiator's Finale"),
equipped: field(""),
substats: field("CRIT Rate, CRIT DMG, Energy Recharge, ATK%"),
},
};
expect(getAutoReviewReason(capture, parsed)).toBe("");
});
});