"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 semantic_memory_1 = require("../walls/06-memory/stores/semantic-memory");
describe('Semantic Memory', () => {
    beforeAll(() => { (0, database_1.getDb)(); });
    afterEach(() => {
        const db = (0, database_1.getDb)();
        db.prepare('DELETE FROM memory_events WHERE project = ?').run('semantic-test');
    });
    it('finds semantic matches', () => {
        (0, memory_event_store_1.recordMemoryEvent)({ project: 'semantic-test', type: 'error', summary: 'Login authentication bug', importance: 7, topic: 'auth' });
        const results = (0, semantic_memory_1.semanticSearchMemories)({ query: 'auth issue', project: 'semantic-test' });
        expect(results.length).toBeGreaterThanOrEqual(1);
    });
    it('gets related memories', () => {
        (0, memory_event_store_1.recordMemoryEvent)({ project: 'semantic-test', type: 'decision', summary: 'Use React auth flow', importance: 8, topic: 'auth' });
        (0, memory_event_store_1.recordMemoryEvent)({ project: 'semantic-test', type: 'fix', summary: 'Fix authentication redirect', importance: 7, topic: 'auth' });
        const db = (0, database_1.getDb)();
        const row = db.prepare('SELECT id FROM memory_events WHERE project = ? ORDER BY id ASC LIMIT 1').get('semantic-test');
        const related = (0, semantic_memory_1.getRelatedMemories)(row.id, 5);
        expect(Array.isArray(related)).toBe(true);
    });
    it('returns semantic topics', () => {
        (0, memory_event_store_1.recordMemoryEvent)({ project: 'semantic-test', type: 'edit', summary: 'Improve database query', importance: 5, topic: 'database' });
        const topics = (0, semantic_memory_1.getSemanticTopics)('semantic-test', 'db optimization');
        expect(topics.length).toBeGreaterThanOrEqual(1);
    });
});
//# sourceMappingURL=semantic-memory.test.js.map