Improve market audit UI and capture diagnostics
This commit is contained in:
+17
-4
@@ -1,7 +1,9 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import {
|
||||
cleanItemName,
|
||||
combineRects,
|
||||
displayCaptureIssue,
|
||||
isCalibrationReady,
|
||||
isRectInside,
|
||||
parseFieldValue,
|
||||
@@ -11,6 +13,17 @@ import {
|
||||
resolveFieldRect,
|
||||
} from "../src/parser.js";
|
||||
|
||||
test("keeps only letters, digits and spaces in OCR item names", () => {
|
||||
assert.equal(cleanItemName(" ~~ Soulshot: S-grade ` "), "Soulshot S grade");
|
||||
assert.equal(cleanItemName("Кристалл № 12"), "Кристалл 12");
|
||||
});
|
||||
|
||||
test("explains why display capture is unavailable", () => {
|
||||
assert.equal(displayCaptureIssue({ secure: true, supported: true, topLevel: true }), null);
|
||||
assert.match(displayCaptureIssue({ secure: false, supported: false, topLevel: true }).detail, /HTTPS/);
|
||||
assert.match(displayCaptureIssue({ secure: true, supported: true, topLevel: false }).title, /встроенном/);
|
||||
});
|
||||
|
||||
test("normalizes a reverse drag into a positive rectangle", () => {
|
||||
assert.deepEqual(rectFromPoints({ x: 140, y: 90 }, { x: 20, y: 30 }), {
|
||||
x: 20,
|
||||
@@ -100,17 +113,17 @@ test("parses a hovered item tooltip", () => {
|
||||
assert.deepEqual(
|
||||
parseTooltipText("Blessed Spiritshot: D-Grade (D) (5,600)\nFor Each 56 Adena"),
|
||||
{
|
||||
name: "Blessed Spiritshot: D-Grade (D)",
|
||||
name: "Blessed Spiritshot D Grade D",
|
||||
quantity: 5600,
|
||||
priceAdena: 56,
|
||||
rawText: "Blessed Spiritshot: D-Grade (D) (5,600)\nFor Each 56 Adena",
|
||||
},
|
||||
);
|
||||
assert.deepEqual(parseTooltipText("Animal Skin (18),,.\nFor Each 400 Adena"), {
|
||||
name: "Animal Skin ,,.",
|
||||
assert.deepEqual(parseTooltipText("~~ Animal Skin (18),,.\nFor Each 400 Adena"), {
|
||||
name: "Animal Skin",
|
||||
quantity: 18,
|
||||
priceAdena: 400,
|
||||
rawText: "Animal Skin (18),,.\nFor Each 400 Adena",
|
||||
rawText: "~~ Animal Skin (18),,.\nFor Each 400 Adena",
|
||||
});
|
||||
assert.equal(parseTooltipText("Purchase List\nAdena 5,403,160"), null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user