diff --git a/tests/package/wp7-02-controlled-executor.test.mjs b/tests/package/wp7-02-controlled-executor.test.mjs index 9498f08..c106e8e 100644 --- a/tests/package/wp7-02-controlled-executor.test.mjs +++ b/tests/package/wp7-02-controlled-executor.test.mjs @@ -216,6 +216,15 @@ test("TDD-WP7-EXT-001 retries one timeout once and records every real attempt", }); test("TDD-WP7-EXT-001 describes only protocol structure and stops repeated contract-shape calls", async () => { + const uriShape = describeProviderResponseShape({ candidates: [{ content: { parts: [{ text: "https://first.invalid/generated" }] } }] }); + const equivalentUriShape = describeProviderResponseShape({ candidates: [{ content: { parts: [{ text: "https://other.invalid/result" }] } }] }); + assert.deepEqual(uriShape, equivalentUriShape); + assert.match(JSON.stringify(uriShape), /"representation":"uri"/); + assert.doesNotMatch(JSON.stringify(uriShape), /first\.invalid|other\.invalid/); + assert.match(JSON.stringify(describeProviderResponseShape({ candidates: [{ content: { parts: [{ text: "![result](https:\/\/example.invalid\/generated)" }] } }] })), /"representation":"markdown_uri"/); + assert.match(JSON.stringify(describeProviderResponseShape({ candidates: [{ content: { parts: [{ text: "data:image\/png;base64,AAAA" }] } }] })), /"representation":"inline_media"/); + assert.match(JSON.stringify(describeProviderResponseShape({ candidates: [{ content: { parts: [{ text: "ordinary explanation" }] } }] })), /"representation":"plain_text"/); + let fetchCalls = 0; const execution = await runControlledRealScenarios({ fetchImpl: async () => {