mirror of
https://github.com/markwylde/claude-code-gitea-action.git
synced 2026-02-19 10:02:50 +08:00
49 lines
1.2 KiB
TypeScript
49 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: "",
|
|
},
|
|
];
|
|
|
|
const result = await downloadCommentImages(noopClient, "owner", "repo", comments);
|
|
|
|
expect(result.size).toBe(0);
|
|
expect(consoleLogSpy).toHaveBeenCalled();
|
|
});
|
|
});
|