mirror of
https://github.com/morluto/rea.git
synced 2026-11-15 19:23:24 +00:00
* refactor(native): read retained inventory views through the operation fact contracts * refactor(native): read matching inventories through the operation fact contracts (#10887) * refactor(native): read dispatch symbol fallbacks as lenient name facts at the port (#10889) * refactor(native): read dispatch symbol fallbacks as lenient name facts at the port * test(native): accept undeclared name-row fields in both dispatch consumers * refactor(native): read literal searches and overview counts as operation facts (#10894) * refactor(native): read literal searches and overview counts as operation facts * refactor(native): read addressed inventory rows as operation facts in every reader (#10899) * refactor(native): read addressed inventory rows as operation facts in every reader * test(native): cover xrefs name resolution through the name fact contract * test(server): pin procedure completion to the procedure inventory contract
55 lines
1.4 KiB
TypeScript
55 lines
1.4 KiB
TypeScript
import { expect, it } from "vitest";
|
|
|
|
import type { JsonValue } from "../domain/jsonValue.js";
|
|
import { ok } from "../domain/result.js";
|
|
import {
|
|
createAnalysisExecution,
|
|
type AnalysisOperationPort,
|
|
} from "./AnalysisProvider.js";
|
|
import { resolveXrefsName } from "./XrefsAddressResolution.js";
|
|
|
|
const names = (rows: JsonValue): AnalysisOperationPort => ({
|
|
execute: async () =>
|
|
ok(
|
|
createAnalysisExecution(rows, {
|
|
id: "fixture",
|
|
name: "Fixture",
|
|
version: "1",
|
|
}),
|
|
),
|
|
});
|
|
|
|
it("resolves an exact name from rows carrying undeclared provider fields", async () => {
|
|
expect(
|
|
await resolveXrefsName(
|
|
names([{ address: "0x10", value: "main", provider_rank: 1 }]),
|
|
"main",
|
|
),
|
|
).toEqual({ ok: true, value: "0x10" });
|
|
});
|
|
|
|
it("refuses a malformed name row with field diagnostics", async () => {
|
|
expect(
|
|
await resolveXrefsName(names([{ address: 16, value: "main" }]), "main"),
|
|
).toMatchObject({
|
|
ok: false,
|
|
error: {
|
|
_tag: "AnalysisOutputError",
|
|
operation: "list_names",
|
|
diagnostics: { contract_issues: [{ path: [0, "address"] }] },
|
|
},
|
|
});
|
|
});
|
|
|
|
it("refuses a name row without an address it could pass back to xrefs", async () => {
|
|
expect(
|
|
await resolveXrefsName(names([{ address: "", value: "main" }]), "main"),
|
|
).toMatchObject({
|
|
ok: false,
|
|
error: {
|
|
_tag: "AnalysisOutputError",
|
|
reason: "Invalid symbol inventory entry at index 0",
|
|
},
|
|
});
|
|
});
|