Scaffold Forgejo issue sync plugin
This commit is contained in:
commit
471520e6b3
21 changed files with 1970 additions and 0 deletions
45
tests/attachment-policy.spec.ts
Normal file
45
tests/attachment-policy.spec.ts
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { ATTACHMENT_NOTE } from "../src/constants.js";
|
||||
import { assessAttachmentReview, buildForgejoSyncContent } from "../src/attachment-policy.js";
|
||||
import manifest from "../src/manifest.js";
|
||||
|
||||
describe("attachment policy", () => {
|
||||
it("appends the visible attachment note and metadata summary", () => {
|
||||
const result = buildForgejoSyncContent("Bug report body", [
|
||||
{
|
||||
filename: "screenshot.png",
|
||||
mimeType: "image/png",
|
||||
sizeBytes: 2048,
|
||||
sourceUrl: "https://forgejo.example/files/1",
|
||||
sourceId: "1"
|
||||
}
|
||||
]);
|
||||
|
||||
expect(result.markdown).toContain(ATTACHMENT_NOTE);
|
||||
expect(result.markdown).toContain("screenshot.png | image/png | 2.0 KiB");
|
||||
expect(result.reviewSignal.reasonCode).toBe("attachment_metadata_present");
|
||||
});
|
||||
|
||||
it("marks payloads for manual review when the text depends on attachments", () => {
|
||||
const review = assessAttachmentReview("See attached screenshot for the only repro details.", [
|
||||
{
|
||||
filename: "repro.png",
|
||||
mimeType: "image/png",
|
||||
sizeBytes: 1024,
|
||||
sourceUrl: null,
|
||||
sourceId: "abc"
|
||||
}
|
||||
]);
|
||||
|
||||
expect(review.manualReviewRequired).toBe(true);
|
||||
expect(review.reasonCode).toBe("attachments_context_required");
|
||||
});
|
||||
|
||||
it("keeps managed resources out of the manifest", () => {
|
||||
expect(manifest).not.toHaveProperty("agents");
|
||||
expect(manifest).not.toHaveProperty("skills");
|
||||
expect(manifest).not.toHaveProperty("routines");
|
||||
expect(manifest.capabilities).not.toContain("agents.managed");
|
||||
expect(manifest.capabilities).not.toContain("skills.managed");
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue