"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 memory_charts_1 = require("../walls/06-memory/stores/memory-charts");
describe('Memory Charts', () => {
    beforeAll(() => {
        (0, database_1.getDb)();
    });
    afterEach(() => {
        const db = (0, database_1.getDb)();
        db.prepare('DELETE FROM memory_events WHERE project = ?').run('charts-test');
    });
    it('renderActivityChart returns string', () => {
        const chart = (0, memory_charts_1.renderActivityChart)('charts-test', 7);
        expect(typeof chart).toBe('string');
        expect(chart).toContain('Activity Chart');
    });
    it('renderTypeDistribution returns string', () => {
        (0, memory_event_store_1.recordMemoryEvent)({ project: 'charts-test', type: 'edit', summary: 'Test edit', importance: 3 });
        (0, memory_event_store_1.recordMemoryEvent)({ project: 'charts-test', type: 'error', summary: 'Test error', importance: 7 });
        const chart = (0, memory_charts_1.renderTypeDistribution)('charts-test');
        expect(typeof chart).toBe('string');
        expect(chart).toContain('Event Type Distribution');
    });
    it('renderImportanceChart returns string', () => {
        (0, memory_event_store_1.recordMemoryEvent)({ project: 'charts-test', type: 'decision', summary: 'Decision', importance: 9 });
        const chart = (0, memory_charts_1.renderImportanceChart)('charts-test');
        expect(typeof chart).toBe('string');
        expect(chart).toContain('Importance Distribution');
    });
    it('renderTimelineChart returns string', () => {
        const chart = (0, memory_charts_1.renderTimelineChart)('charts-test', 1);
        expect(typeof chart).toBe('string');
        expect(chart).toContain('Hourly Activity');
    });
    it('renderFullDashboard returns combined output', () => {
        (0, memory_event_store_1.recordMemoryEvent)({ project: 'charts-test', type: 'edit', summary: 'Edit', importance: 3 });
        const dashboard = (0, memory_charts_1.renderFullDashboard)('charts-test');
        expect(typeof dashboard).toBe('string');
        expect(dashboard).toContain('Activity Chart');
        expect(dashboard).toContain('Event Type Distribution');
        expect(dashboard).toContain('Importance Distribution');
    });
    it('renderActivityChart with no data shows empty bars', () => {
        const chart = (0, memory_charts_1.renderActivityChart)('no-data-project', 3);
        expect(chart).toContain('Activity Chart');
        // Should still have lines even with no data
        expect(chart.split('\n').length).toBeGreaterThan(2);
    });
});
//# sourceMappingURL=memory-charts.test.js.map