test: clarify environment and desktop contract checks

This commit is contained in:
morluto committed 2026-11-08 00:05:59 +08:00
1 parent ab9dc4569f
commit 872890bef3
5 files changed
+19 -19

No files matched your search

@@ -938,18 +938,18 @@ describe("served catalog", () => {
"patch_books_by_id",
"post_books",
]);
expect(described.get("post_books")?.description).toContain(
'creates an entity of /api/books in the served environment state (body members "name"; required: "name"), modelled on the recorded calls',
expect(described.get("post_books")?.description).toMatch(
/creates an entity.*\/api\/books.*"name".*required.*"name"/iu,
);
expect(described.get("patch_books_by_id")?.description).toContain(
'changes the entity the path names in the served environment state (body members "name"; send at least one)',
expect(described.get("patch_books_by_id")?.description).toMatch(
/changes the entity.*path.*"name".*send at least one/iu,
);
expect(described.get("delete_books_by_id")?.description).toContain(
"removes the entity the path names from the served environment state",
);
expect(described.get("post_books")?.annotations.readOnlyHint).toBe(false);
expect(described.get("get_books")?.description).toContain(
"answers from the served environment state where the state backs this tool",
expect(described.get("get_books")?.description).toMatch(
/answers.*served environment state.*state backs this tool/iu,
);
});
@@ -5,8 +5,8 @@ import { toolContract } from "../toolContracts.js";
const entropy = toolContract("inspect_byte_entropy");
it("warns that complete byte-entropy output can become very large", () => {
expect(entropy.description).toContain(
"Complete output can become very large because it includes one row per selected block, and summary detail still retains that full list.",
expect(entropy.description).toMatch(
/output.*large.*one row per selected block.*summary.*full list/iu,
);
expect(entropy.description).toContain(
"Use a shorter length or a larger block_size",
+2 -2
View File
@@ -114,8 +114,8 @@ describe("inspectPackageFile", () => {
);
expect(snap.calls).toEqual([]);
expect(snap.facts.package_file_reason).toContain(
"dpkg reports no installed version of the application (snap varicad2026-en)",
expect(snap.facts.package_file_reason).toMatch(
/dpkg.*no installed version.*snap varicad2026-en/iu,
);
expect(directory).toEqual({
package_file_reason: `${join(folder, "a.deb")} is not a regular file`,
+3 -2
View File
@@ -506,8 +506,9 @@ describe.skipIf(process.platform === "win32")("vendor repositories", () => {
},
],
library_packages: [],
library_packages_reason:
"ldconfig -p did not list the dynamic linker cache",
library_packages_reason: expect.stringMatching(
/ldconfig -p.*did not list.*dynamic linker cache/iu,
),
});
expect(result.value.signingKeys.size).toBe(0);
});
@@ -401,8 +401,7 @@ describe("state data plane intake", () => {
id: 1,
error: {
code: -32602,
message:
"invalid params: a file:// uri names a path on this host, not a network share",
message: expect.stringMatching(/this host.*not a network share/iu),
},
});
}
@@ -614,7 +613,9 @@ describe("state data plane cancellation", () => {
id: 1,
error: {
code: -32000,
message: "the state document could not be downloaded",
message: expect.stringMatching(
/state document.*could not be downloaded/iu,
),
data: { reason: "cancelled" },
},
},
@@ -623,7 +624,7 @@ describe("state data plane cancellation", () => {
id: 2,
error: {
code: -32000,
message: "the call was cancelled and left the state unchanged",
message: expect.stringMatching(/cancelled.*state unchanged/iu),
data: { reason: "cancelled" },
},
},
@@ -1165,9 +1166,7 @@ describe("serveEnvironment with a state", () => {
expect(tools.map(({ name }) => name)).toEqual(["get_items", "post_search"]);
expect(
tools.find(({ name }) => name === "post_search")?.description,
).toContain(
"answers from the served environment state where the state backs this tool",
);
).toMatch(/answers.*served environment state.*state backs this tool/iu);
await withClient(environment, async (client) => {
const searched = await client.callTool({
name: "post_search",