Files
reverse-engineering-anything/tests/boundary/guidanceSearch.test.ts
T
c88e1b0b43 feat(guidance): search installed workflow sections (#6996)
* feat(guidance): search bundled REA workflow guidance

* fix(guidance): address review findings

* test(guidance): fix boundary and dispatcher coverage

* test(setup): use supported doctor fixture runtime

* fix(guidance): resolve CI conformance, coverage, and review findings

* fix(guidance): own complete requests through shutdown

* test(guidance): bound lifecycle gates and join failed work

---------

Co-authored-by: Deepak-Kambala <deepakkambala07@gmail.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-10-29 16:47:10 +08:00

54 lines
1.8 KiB
TypeScript

import { expect, it } from "vitest";
import { ArtifactResourceScope } from "../../src/artifacts/ArtifactResourceScope.js";
import {
readGuidanceSection,
searchGuidance,
} from "../../src/application/GuidanceAccess.js";
it("finds and retrieves the selected section from the generated package bundle", async () => {
const resources = new ArtifactResourceScope();
try {
const result = await searchGuidance(
{ query: "exact JavaScript module" },
resources,
);
if (!result.ok) throw result.error;
expect(result.value).toMatchObject({
status: "matches",
source: "installed_rea_guidance",
package: expect.stringMatching(/^rea-agents@/u),
});
if (result.value.status !== "matches")
throw new Error("Expected guidance matches");
const match = result.value.matches.find(
({ heading }) => heading === "Read a module without repeating analysis",
);
expect(match).toBeDefined();
expect(result.value.matches[0]?.heading).toBe(
"Read a module without repeating analysis",
);
expect(match).toMatchObject({
guide: "references/javascript-applications.md",
matched_terms: expect.arrayContaining(["exact", "javascript", "module"]),
context: expect.stringContaining("javascript-module"),
});
if (match === undefined) throw new Error("Expected selected guidance");
const retrieved = await readGuidanceSection(
{ locator: match.locator },
resources,
);
if (!retrieved.ok) throw retrieved.error;
expect(retrieved.value).toMatchObject({
status: "section",
source: "installed_rea_guidance",
guide: match.guide,
heading: match.heading,
locator: match.locator,
content: expect.stringContaining("node_id"),
});
} finally {
await resources.close();
}
});