fix: tighten contract test regex patterns per review feedback

- tool-info-contract: match icon/title within the ToolInfo type definition
  specifically, not any occurrence in the file
- data-provider-contract: match openFile: props.onOpenFile pattern instead
  of bare substring match
This commit is contained in:
Mark IJbema
2026-03-02 13:52:36 +01:00
parent 3ebff2daf6
commit 020012b3aa
2 changed files with 4 additions and 4 deletions
@@ -24,6 +24,6 @@ describe("DataProvider props contract", () => {
it("openFile is exposed on the context return value", () => {
const src = fs.readFileSync(DATA_CONTEXT_FILE, "utf-8")
expect(src).toContain("openFile:")
expect(src).toMatch(/openFile:\s*props\.onOpenFile/)
})
})
@@ -18,9 +18,9 @@ const MESSAGE_PART_FILE = path.join(MONOREPO_ROOT, "packages/ui/src/components/m
describe("getToolInfo() return shape contract", () => {
it("getToolInfo still exports expected shape fields", () => {
const src = fs.readFileSync(MESSAGE_PART_FILE, "utf-8")
// ToolInfo type must still have these fields
expect(src).toMatch(/icon\s*:/)
expect(src).toMatch(/title\s*:/)
// ToolInfo type definition must still have these fields
expect(src).toMatch(/export type ToolInfo\s*=\s*\{[^}]*icon\s*:/s)
expect(src).toMatch(/export type ToolInfo\s*=\s*\{[^}]*title\s*:/s)
})
it("getToolInfo function is exported", () => {