test: prune redundant cases and promote configuration lifecycle coverage
This commit is contained in:
@@ -9,19 +9,13 @@ import {
|
||||
const target = "draft-2020-12";
|
||||
|
||||
describe("advertised tool JSON Schema", () => {
|
||||
it("projects each canonical contract once per target", () => {
|
||||
it("keeps examples and output schemas aligned with canonical contracts", () => {
|
||||
for (const contract of TOOL_CONTRACTS) {
|
||||
const input = toolInputSchemaWithMetadata(contract)["~standard"];
|
||||
const output = toolOutputSchemaWithMetadata(contract)["~standard"];
|
||||
const advertisedInput = input.jsonSchema.input({ target });
|
||||
const advertisedOutput = output.jsonSchema.output({ target });
|
||||
|
||||
expect(input.jsonSchema.input({ target }), contract.name).toBe(
|
||||
advertisedInput,
|
||||
);
|
||||
expect(output.jsonSchema.output({ target }), contract.name).toBe(
|
||||
advertisedOutput,
|
||||
);
|
||||
expect(advertisedInput.examples, contract.name).toEqual(
|
||||
contract.examples.map(({ input: example }) => example),
|
||||
);
|
||||
@@ -36,20 +30,8 @@ describe("advertised tool JSON Schema", () => {
|
||||
const input = toolInputSchemaWithMetadata(contract)["~standard"];
|
||||
const latest = input.jsonSchema.input({ target });
|
||||
const draft07 = input.jsonSchema.input({ target: "draft-07" });
|
||||
const libraryOptions = { unrepresentable: "any" };
|
||||
const configured = input.jsonSchema.input({ target, libraryOptions });
|
||||
|
||||
expect(latest.$schema).toBe("https://json-schema.org/draft/2020-12/schema");
|
||||
expect(draft07.$schema).toBe("http://json-schema.org/draft-07/schema#");
|
||||
expect(input.jsonSchema.input({ target: "draft-07" })).toBe(draft07);
|
||||
expect(configured).not.toBe(latest);
|
||||
expect(input.jsonSchema.input({ target, libraryOptions })).not.toBe(
|
||||
configured,
|
||||
);
|
||||
expect(
|
||||
toolInputSchemaWithMetadata(contract).safeParse(
|
||||
contract.examples[0]?.input,
|
||||
).success,
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user