Skip to content

Commit 3134d91

Browse files
authored
✨ add Job info to RST output (#448)
1 parent 8844ae3 commit 3134d91

4 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/geometry/polygon.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,8 @@ export class Polygon extends Array<Point> {
4545
const yCoords = this.getMinMaxY();
4646
return isPointInY(point, yCoords.min, yCoords.max);
4747
}
48+
49+
toString(): string {
50+
return this.map((point) => `(${point})`).join(", ");
51+
}
4852
}

src/v2/parsing/inference/baseInference.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export abstract class BaseInference {
3232
return (
3333
"Inference\n" +
3434
"#########\n" +
35+
this.job.toString() + "\n" +
3536
this.model.toString() + "\n" +
3637
this.file.toString() + "\n"
3738
);

tests/v2/product/crop.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import path from "path";
22
import assert from "node:assert/strict";
3+
import { promises as fs } from "fs";
34
import { describe, it } from "node:test";
45
import { Polygon } from "@/geometry/index.js";
56
import { crop } from "@/v2/product/index.js";
@@ -101,4 +102,18 @@ describe("MindeeV2 - Crop Response", async () => {
101102
assert.strictEqual(secondPolygon[3][0], 0.547);
102103
assert.strictEqual(secondPolygon[3][1], 0.97);
103104
});
105+
106+
describe("RST Display", async () => {
107+
it("to be properly exposed", async () => {
108+
const response = await loadV2Response(
109+
crop.CropResponse,
110+
path.join(V2_PRODUCT_PATH, "crop", "crop_single.json")
111+
);
112+
const rstString = await fs.readFile(
113+
path.join(V2_PRODUCT_PATH, "crop", "crop_single.rst"), "utf8"
114+
);
115+
assert.notStrictEqual(response.inference, null);
116+
assert.strictEqual(response.inference.toString(), rstString);
117+
});
118+
});
104119
});

0 commit comments

Comments
 (0)