diff --git a/exercises/03.resources/03.problem.list/src/index.test.ts b/exercises/03.resources/03.problem.list/src/index.test.ts index b2170a4..b80fdb6 100644 --- a/exercises/03.resources/03.problem.list/src/index.test.ts +++ b/exercises/03.resources/03.problem.list/src/index.test.ts @@ -149,38 +149,17 @@ test('Resource List - Entries', async () => { const list = await client.listResources() - // 🚨 Proactive check: Ensure list callback returns actual entries + // Since entries don't have a list callback, they shouldn't appear in the resources list const entryResources = list.resources.filter((r) => r.uri.includes('entries')) - invariant( - entryResources.length > 0, - '🚨 No entry resources found in list - the list callback should return actual entries from the database', - ) + expect(entryResources).toHaveLength(0) - // Check that we have at least the entries we created - const foundEntries = entryResources.filter( - (r) => r.uri.includes('entries/1') || r.uri.includes('entries/2'), - ) - invariant( - foundEntries.length >= 2, - '🚨 List should return the entries that were created', + // Verify that the entries template exists but doesn't have a list callback + const templatesList = await client.listResourceTemplates() + const entriesTemplate = templatesList.resourceTemplates.find( + (rt) => rt.uriTemplate.includes('entries') && rt.uriTemplate.includes('{'), ) - - // Validate the structure of listed resources - entryResources.forEach((resource) => { - expect(resource).toEqual( - expect.objectContaining({ - name: expect.any(String), - uri: expect.stringMatching(/epicme:\/\/entries\/\d+/), - mimeType: 'application/json', - }), - ) - - // 🚨 Proactive check: List should not include content (only metadata) - invariant( - !('text' in resource), - '🚨 Resource list should only contain metadata, not the full content - use readResource to get content', - ) - }) + expect(entriesTemplate).toBeDefined() + expect(entriesTemplate?.list).toBeUndefined() }) test('Resource List - Tags', async () => { @@ -222,7 +201,7 @@ test('Resource List - Tags', async () => { expect.objectContaining({ name: expect.any(String), uri: expect.stringMatching(/epicme:\/\/tags\/\d+/), - mimeType: 'application/json', + mimeType: 'text/plain', }), ) }) diff --git a/exercises/03.resources/03.solution.list/src/index.test.ts b/exercises/03.resources/03.solution.list/src/index.test.ts index a19329c..b80fdb6 100644 --- a/exercises/03.resources/03.solution.list/src/index.test.ts +++ b/exercises/03.resources/03.solution.list/src/index.test.ts @@ -201,7 +201,7 @@ test('Resource List - Tags', async () => { expect.objectContaining({ name: expect.any(String), uri: expect.stringMatching(/epicme:\/\/tags\/\d+/), - mimeType: 'application/json', + mimeType: 'text/plain', }), ) }) diff --git a/exercises/03.resources/03.solution.list/src/resources.ts b/exercises/03.resources/03.solution.list/src/resources.ts index fdff145..c7cfe58 100644 --- a/exercises/03.resources/03.solution.list/src/resources.ts +++ b/exercises/03.resources/03.solution.list/src/resources.ts @@ -33,7 +33,7 @@ export async function initializeResources(agent: EpicMeMCP) { resources: tags.map((tag) => ({ name: tag.name, uri: `epicme://tags/${tag.id}`, - mimeType: 'application/json', + mimeType: 'text/plain', })), } },