fix(int-tests): fix failing integration tests (#7516)

This commit is contained in:
Gal Zahavi
2025-08-31 17:45:12 -07:00
committed by GitHub
parent f331e5d5b6
commit c7c709fb3c
2 changed files with 19 additions and 10 deletions

View File

@@ -31,7 +31,7 @@ describe('session-summary flag', () => {
const summary = JSON.parse(summaryContent);
expect(summary).toBeDefined();
expect(summary.models).toBeDefined();
expect(summary.tools).toBeDefined();
expect(summary.sessionMetrics.models).toBeDefined();
expect(summary.sessionMetrics.tools).toBeDefined();
});
});

View File

@@ -5,8 +5,8 @@
*/
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
import { writeFileSync } from 'node:fs';
import { join } from 'node:path';
import { writeFileSync, readFileSync } from 'node:fs';
import { join, resolve } from 'node:path';
import { TestRig } from './test-helper.js';
// Windows skip (Option A: avoid infra scope)
@@ -50,10 +50,6 @@ const utf32BE = (s: string) => {
return Buffer.concat([bom, payload]);
};
// Minimal binary sentinel (PNG header only)
const fakePng = () =>
Buffer.from([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a]);
let rig: TestRig;
let dir: string;
@@ -126,7 +122,20 @@ d('BOM end-to-end integration', () => {
);
});
it('Binary sentinel', async () => {
await runAndAssert('image.png', fakePng(), null);
it('Can describe a PNG file', async () => {
const imagePath = resolve(
process.cwd(),
'docs/assets/gemini-screenshot.png',
);
const imageContent = readFileSync(imagePath);
const filename = 'gemini-screenshot.png';
writeFileSync(join(dir, filename), imageContent);
const prompt = `describe the image ${filename}`;
const output = await rig.run(prompt);
await rig.waitForToolCall('read_file');
const lower = output.toLowerCase();
expect(lower.includes('screenshot')).toBeTruthy();
expect(lower.includes('gemini cli')).toBeTruthy();
expect(lower.includes('terminal')).toBeTruthy();
});
});