Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
test(mcp-host): give four negative assertions a witness that they ran
marcoteb63389e30dfc6
diff --git a/mcp-host/src/__tests__/artifacts/officePackageText.test.ts b/mcp-host/src/__tests__/artifacts/officePackageText.test.tsindex 7377749b0..0031d4c08 100644--- a/mcp-host/src/__tests__/artifacts/officePackageText.test.ts+++ b/mcp-host/src/__tests__/artifacts/officePackageText.test.ts@@ -91,6 +91,8 @@ describe('officePackageHasText', () => {'word/media/image1.png': Buffer.from(needle),})expect(officePackageHasText(docx, holds)).toBe(false)+ // Witness: the same reader finds what the package does hold.+ expect(officePackageHasText(docx, text => text.includes('3,141,592,653'))).toBe(true)})it.each([diff --git a/mcp-host/src/core/tools/__tests__/generatedArtifactAttachments.test.ts b/mcp-host/src/core/tools/__tests__/generatedArtifactAttachments.test.tsindex db64cb950..68af9482f 100644--- a/mcp-host/src/core/tools/__tests__/generatedArtifactAttachments.test.ts+++ b/mcp-host/src/core/tools/__tests__/generatedArtifactAttachments.test.ts@@ -3,6 +3,7 @@ import * as fs from 'fs'import JSZip from 'jszip'import * as os from 'os'import * as path from 'path'+import { officePackageHasText } from '../../../artifacts/officePackageText'import { zipEntries } from '../../../workflow/__tests__/support/zipEntries'import { INTERNAL_TOOLS } from '../../../workflow/internalTools'import type { ArtifactMetadata } from '../../../workflow/types'@@ -418,6 +419,9 @@ describe('generated internal artifact attachments', () => {const leaked = await pdf.execute({ filename: 'quoted.pdf', body: `value: ${secret}` })expect(leaked.is_error).toBe(false)expect(leaked.attachments ?? []).toHaveLength(0)+ // Control: the same registry attaches a document without the value.+ const safe = await pdf.execute({ filename: 'safe.pdf', body: 'value: none' })+ expect(safe.attachments ?? []).toHaveLength(1)})it('does not attach a DOCX whose table cell prints a secret a link splits', async () => {@@ -458,6 +462,16 @@ describe('generated internal artifact attachments', () => {})expect(leaked.is_error).toBe(false)expect(leaked.attachments ?? []).toHaveLength(0)+ // Witness: the file the generator wrote prints the value whole.+ const written = fs.readFileSync(generated('split.docx'))+ expect(officePackageHasText(written, text => text.includes('probe-redaction-value'))).toBe(true)+ // Control: the same registry attaches a table without the value.+ const safe = await docx.execute({+ filename: 'safe.docx',+ body: 'Table:',+ tables: [{ headers: ['Value'], rows: [['nothing secret']] }],+ })+ expect(safe.attachments ?? []).toHaveLength(1)})describe('XLSX record keys, which the sheet prints as its header', () => {diff --git a/mcp-host/src/workflow/__tests__/dashboardParts.test.ts b/mcp-host/src/workflow/__tests__/dashboardParts.test.tsindex 5dfc51c39..921447fb6 100644--- a/mcp-host/src/workflow/__tests__/dashboardParts.test.ts+++ b/mcp-host/src/workflow/__tests__/dashboardParts.test.ts@@ -76,6 +76,8 @@ describe('DashboardCharts', () => {'data.charts[0]')expect(charts.specs[0].labels).not.toContain('Phantom')+ // Witness: the kept series' own labels are there.+ expect(charts.specs[0].labels).toEqual(expect.arrayContaining(['Start', 'Change']))})it('reports a chart it cannot draw in its place, escaped', () => {diff --git a/mcp-host/src/workflow/__tests__/internalTools.schemaGemini.test.ts b/mcp-host/src/workflow/__tests__/internalTools.schemaGemini.test.tsindex 2968a2ec6..1413230bd 100644--- a/mcp-host/src/workflow/__tests__/internalTools.schemaGemini.test.ts+++ b/mcp-host/src/workflow/__tests__/internalTools.schemaGemini.test.ts@@ -120,6 +120,9 @@ describe('internal tools, as the Gemini driver actually sends them', () => {it('sends no field the Gemini schema does not define', async () => {const decls = await sendThroughDriver()+ // Witness: there are declarations, each with parameters to read.+ expect(decls.length).toBeGreaterThan(0)+ expect(decls.every(d => d.parameters !== undefined)).toBe(true)const bad: string[] = []for (const d of decls) {const out: string[] = []