Skip to content

Commit 9d15d11

Browse files
test(discovery): cover primary agent-card path and retire T096
1 parent 06a74ac commit 9d15d11

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

.cleo/tasks.db

0 Bytes
Binary file not shown.

tests/discovery.test.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,58 @@ const validConfig: DiscoveryConfig = {
7979
lafsVersion: "1.0.0"
8080
};
8181

82+
const validAgentConfig: DiscoveryConfig = {
83+
agent: {
84+
name: "test-agent",
85+
description: "A2A test agent",
86+
version: "1.0.0",
87+
url: "https://example.com/api/v1/envelope",
88+
capabilities: {
89+
streaming: true,
90+
pushNotifications: false,
91+
extensions: [],
92+
},
93+
defaultInputModes: ["application/json"],
94+
defaultOutputModes: ["application/json"],
95+
skills: [
96+
{
97+
id: "envelope-processor",
98+
name: "Envelope Processor",
99+
description: "Process LAFS envelopes",
100+
tags: ["process", "validate"],
101+
},
102+
],
103+
},
104+
cacheMaxAge: 3600,
105+
};
106+
82107
describe("Discovery Middleware", () => {
108+
describe("GET /.well-known/agent-card.json", () => {
109+
it("should return A2A agent card as primary discovery document", async () => {
110+
const app = createApp(validAgentConfig);
111+
const response = await request(app)
112+
.get("/.well-known/agent-card.json")
113+
.expect(200)
114+
.expect("Content-Type", /json/);
115+
116+
expect(response.body.name).toBe("test-agent");
117+
expect(response.body.capabilities).toBeDefined();
118+
expect(response.body.skills).toBeDefined();
119+
expect(response.body.defaultInputModes).toContain("application/json");
120+
expect(response.body.defaultOutputModes).toContain("application/json");
121+
});
122+
123+
it("should not include legacy deprecation headers on primary path", async () => {
124+
const app = createApp(validAgentConfig);
125+
const response = await request(app)
126+
.get("/.well-known/agent-card.json")
127+
.expect(200);
128+
129+
expect(response.headers.deprecation).toBeUndefined();
130+
expect(response.headers.sunset).toBeUndefined();
131+
});
132+
});
133+
83134
describe("GET /.well-known/lafs.json", () => {
84135
it("should return valid JSON", async () => {
85136
const app = createApp(validConfig);

0 commit comments

Comments
 (0)