Skip to content

Canvix — Free & open-source graphic design tool. A community-built Canva alternative with a drag-and-drop editor, templates, shapes, text, images & one-click export. Works on desktop, tablet & mobile.

fix(e2e): byo-mcp — assert not-found on the raw text, not JSON.parse

Ashiq Hussain Mir59d26c4e3759
diff --git a/tests/e2e/byo-mcp.spec.ts b/tests/e2e/byo-mcp.spec.ts
index 519be58..18c346c 100644
--- a/tests/e2e/byo-mcp.spec.ts
+++ b/tests/e2e/byo-mcp.spec.ts
@@ -126,11 +126,14 @@ test.describe('BYO-MCP: personal tokens (v0.25)', () => {
expect(names).not.toContain('Owned by someone else')
expect(names).not.toContain('e2e mcp commons')
- // 3. get_design on a foreign id → not-found (no enumeration)
+ // 3. get_design on a foreign id → not-found (no enumeration).
+ // fail() answers with PLAIN TEXT ("Design "…" was not found."), not
+ // JSON — assert on the text itself (that IS the security property).
const foreign = await mcpCall(request, key, 'tools/call', { name: 'get_design', arguments: { design_id: 'd_e2e_mcp_other' } })
expect(foreign.status).toBe(200)
- const foreignPayload = JSON.parse(foreign.body.result.content[0].text)
- expect(foreignPayload.error).toBeTruthy()
+ const foreignText = foreign.body.result.content[0].text as string
+ expect(foreignText).toContain('not found')
+ expect(foreignText).not.toContain('Owned by someone else') // no data leak in the error
// get_design on own design works
const own = await mcpCall(request, key, 'tools/call', { name: 'get_design', arguments: { design_id: 'd_e2e_mcp_mine' } })