mirror of
https://github.com/samsonjs/Peekaboo.git
synced 2026-03-25 09:25:47 +00:00
- Update CI configuration to use macOS-15 runner with Xcode 16.3 - Expand test coverage with comprehensive new test suites: * JSONOutputTests.swift - JSON encoding/decoding and MCP compliance * LoggerTests.swift - Thread-safe logging functionality * ImageCaptureLogicTests.swift - Image capture command logic * TestTags.swift - Centralized test tagging system - Improve existing tests with Swift Testing patterns and async support - Make Logger thread-safe with concurrent dispatch queue - Add performance, concurrency, and edge case testing - Fix compilation issues and optimize test performance 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
72 lines
No EOL
2.5 KiB
TypeScript
72 lines
No EOL
2.5 KiB
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { buildImageSummary } from "../../../src/utils/image-summary";
|
|
import { ImageInput, ImageCaptureData } from "../../../src/types";
|
|
|
|
describe("buildImageSummary", () => {
|
|
it("should return a message if no files were saved", () => {
|
|
const input: ImageInput = { capture_focus: "background" };
|
|
const data: ImageCaptureData = { saved_files: [] };
|
|
const summary = buildImageSummary(input, data);
|
|
expect(summary).toBe(
|
|
"Image capture completed but no files were saved or available for analysis.",
|
|
);
|
|
});
|
|
|
|
it("should generate a summary for a single saved file without a question", () => {
|
|
const input: ImageInput = {
|
|
path: "/path/to/image.png",
|
|
capture_focus: "background",
|
|
};
|
|
const data: ImageCaptureData = {
|
|
saved_files: [{ path: "/path/to/image.png", mime_type: "image/png" }],
|
|
};
|
|
const summary = buildImageSummary(input, data);
|
|
expect(summary).toBe(
|
|
"Captured 1 image\nImage saved to: /path/to/image.png",
|
|
);
|
|
});
|
|
|
|
it("should generate a summary for a single saved file with a question and path", () => {
|
|
const input: ImageInput = {
|
|
path: "/path/to/image.png",
|
|
capture_focus: "background",
|
|
};
|
|
const data: ImageCaptureData = {
|
|
saved_files: [{ path: "/path/to/image.png", mime_type: "image/png" }],
|
|
};
|
|
const summary = buildImageSummary(input, data, "What is this?");
|
|
expect(summary).toBe(
|
|
"Captured 1 image\nImage saved to: /path/to/image.png",
|
|
);
|
|
});
|
|
|
|
it("should generate a summary for a single temporary file with a question", () => {
|
|
const input: ImageInput = { capture_focus: "background" };
|
|
const data: ImageCaptureData = {
|
|
saved_files: [{ path: "/tmp/image.png", mime_type: "image/png" }],
|
|
};
|
|
const summary = buildImageSummary(input, data, "What is this?");
|
|
expect(summary).toBe("Captured 1 image");
|
|
});
|
|
|
|
it("should generate a summary for multiple saved files", () => {
|
|
const input: ImageInput = {
|
|
path: "/path/to/",
|
|
capture_focus: "background",
|
|
};
|
|
const data: ImageCaptureData = {
|
|
saved_files: [
|
|
{ path: "/path/to/image1.png", mime_type: "image/png" },
|
|
{
|
|
path: "/path/to/image2.png",
|
|
mime_type: "image/png",
|
|
item_label: "Finder",
|
|
},
|
|
],
|
|
};
|
|
const summary = buildImageSummary(input, data);
|
|
expect(summary).toBe(
|
|
"Captured 2 images\n2 images saved:\n1. /path/to/image1.png\n2. /path/to/image2.png (Finder)",
|
|
);
|
|
});
|
|
});
|