"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const database_1 = require("../walls/06-memory/database/database");
const memory_event_store_1 = require("../walls/06-memory/stores/memory-event-store");
const ai_memory_summarizer_1 = require("../walls/06-memory/stores/ai-memory-summarizer");
describe('AI Memory Summarizer', () => {
    beforeAll(() => { (0, database_1.getDb)(); });
    afterEach(() => {
        const db = (0, database_1.getDb)();
        db.prepare('DELETE FROM memory_events WHERE project = ?').run('enrich-test');
        db.prepare('DELETE FROM memory_summaries WHERE project = ?').run('enrich-test');
    });
    it('generateEnrichedSummary returns summary', () => {
        (0, memory_event_store_1.recordMemoryEvent)({ project: 'enrich-test', type: 'edit', summary: 'Test edit', importance: 3 });
        (0, memory_event_store_1.recordMemoryEvent)({ project: 'enrich-test', type: 'decision', summary: 'Use Jest', importance: 8 });
        const summary = (0, ai_memory_summarizer_1.generateEnrichedSummary)('enrich-test', 'daily');
        expect(summary.project).toBe('enrich-test');
        expect(summary.totalEvents).toBeGreaterThanOrEqual(2);
        expect(summary.aiPrompt).toContain('Analyze this daily memory summary');
        expect(summary.aiPrompt).toContain('enrich-test');
    });
    it('generateEnrichedSummary weekly', () => {
        const summary = (0, ai_memory_summarizer_1.generateEnrichedSummary)('enrich-test', 'weekly');
        expect(summary.period).toBe('weekly');
        expect(summary.aiPrompt).toContain('weekly');
    });
    it('saveEnrichedSummary saves to DB', () => {
        (0, memory_event_store_1.recordMemoryEvent)({ project: 'enrich-test', type: 'edit', summary: 'Edit', importance: 3 });
        const summary = (0, ai_memory_summarizer_1.generateEnrichedSummary)('enrich-test', 'daily');
        (0, ai_memory_summarizer_1.saveEnrichedSummary)(summary);
        expect(summary.saved).toBe(true);
        const summaries = (0, ai_memory_summarizer_1.getEnrichedSummaries)('enrich-test');
        expect(summaries.length).toBeGreaterThanOrEqual(1);
    });
    it('getEnrichedSummaries returns recent', () => {
        const summaries = (0, ai_memory_summarizer_1.getEnrichedSummaries)('enrich-test', 5);
        expect(Array.isArray(summaries)).toBe(true);
    });
});
//# sourceMappingURL=ai-memory-summarizer.test.js.map