claude-code-gitea-action/test/image-downloader.test.ts
claude (ops) 32685a740f
Some checks failed
Test Custom Executables / test-custom-executables (push) Has been cancelled
CI / test (push) Has been cancelled
CI / prettier (push) Has been cancelled
CI / typecheck (push) Has been cancelled
Sync Base Action to claude-code-base-action / Sync base-action to claude-code-base-action repository (push) Has been cancelled
Test Claude Code Action / test-inline-prompt (push) Has been cancelled
Test Claude Code Action / test-prompt-file (push) Has been cancelled
Test Claude Env Feature / test-claude-env-with-comments (push) Has been cancelled
Test MCP Servers / test-mcp-integration (push) Has been cancelled
Test MCP Servers / test-mcp-config-flag (push) Has been cancelled
Test Settings Feature / test-settings-inline-allow (push) Has been cancelled
Test Settings Feature / test-settings-inline-deny (push) Has been cancelled
Test Settings Feature / test-settings-file-allow (push) Has been cancelled
Test Settings Feature / test-settings-file-deny (push) Has been cancelled
Forgejo-patched claude-code-gitea-action (View-job URL uses per-repo run index)
Fork of markwylde/claude-code-gitea-action@b744372 (v1.0.21) with the
'View job' link fixed to use GITHUB_RUN_NUMBER (per-repo index) instead of
GITHUB_RUN_ID (global id), because Forgejo routes run pages by per-repo index.
See VENDOR.txt.
2026-07-01 06:42:55 +00:00

48 lines
1.2 KiB
TypeScript

import { describe, test, expect, spyOn, beforeEach, afterEach } from "bun:test";
import {
downloadCommentImages,
type CommentWithImages,
} from "../src/github/utils/image-downloader";
const noopClient = { api: {} } as any;
describe("downloadCommentImages", () => {
let consoleLogSpy: any;
beforeEach(() => {
consoleLogSpy = spyOn(console, "log").mockImplementation(() => {});
});
afterEach(() => {
consoleLogSpy.mockRestore();
});
test("returns empty map and logs disabled message", async () => {
const result = await downloadCommentImages(
noopClient,
"owner",
"repo",
[] as CommentWithImages[],
);
expect(result.size).toBe(0);
expect(consoleLogSpy).toHaveBeenCalledWith(
"Image downloading temporarily disabled during Octokit migration",
);
});
test("ignores provided comments while feature disabled", async () => {
const comments: CommentWithImages[] = [
{
type: "issue_comment",
id: "123",
body: "![img](https://example.com/image.png)",
},
];
const result = await downloadCommentImages(noopClient, "owner", "repo", comments);
expect(result.size).toBe(0);
expect(consoleLogSpy).toHaveBeenCalled();
});
});