import { describe, expect, test, vi } from "vitest";

vi.mock("../sf-db.js", () => ({
	getActiveMemories: vi.fn(() => []),
	isDbAvailable: vi.fn(() => true),
	listSelfFeedbackEntries: vi.fn(() => [
		{
			id: "sf-dogfood-fanout-001",
			ts: "2026-05-15T14:03:00.000Z",
			kind: "agent-friction",
			severity: "medium",
			summary:
				"Dogfood run did not expose whether fan-out was skipped intentionally.",
		},
	]),
}));

const { loadSelfFeedbackBlock } = await import(
	"../bootstrap/system-context.js"
);

describe("loadSelfFeedbackBlock", () => {
	test("includes_entry_ids_so_agents_can_act_on_feedback", () => {
		const block = loadSelfFeedbackBlock("/repo");

		expect(block).toContain("sf-dogfood-fanout-001");
		expect(block).toContain("agent-friction");
		expect(block).toContain("Dogfood run did not expose");
	});
});
