"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const teach_store_1 = require("../walls/06-memory/teach/teach-store");
const database_1 = require("../walls/06-memory/database/database");
describe('Teach Store', () => {
    beforeAll(() => {
        (0, database_1.getDb)();
    });
    afterEach(() => {
        (0, teach_store_1.deleteProfile)();
    });
    it('saves and retrieves a section', () => {
        const structured = { minimal_changes: 'Minimal changes', strong_typing: 'Strong typing' };
        (0, teach_store_1.saveProfileSection)('coding_style', '1. Minimal changes\n2. Strong typing', structured, 85);
        const section = (0, teach_store_1.getProfileSection)('coding_style');
        expect(section).not.toBeNull();
        expect(section.rawText).toBe('1. Minimal changes\n2. Strong typing');
        expect(section.structuredData.minimal_changes).toBe('Minimal changes');
        expect(section.importance).toBe(85);
    });
    it('gets full profile', () => {
        (0, teach_store_1.saveProfileSection)('coding_style', 'Minimal changes', { minimal_changes: 'Minimal changes' }, 85);
        (0, teach_store_1.saveProfileSection)('hates', 'No refactors', { no_refactors: 'No refactors' }, 85);
        const profile = (0, teach_store_1.getFullProfile)();
        expect(Object.keys(profile).length).toBe(2);
        expect(profile.coding_style).toBeDefined();
        expect(profile.hates).toBeDefined();
    });
    it('updates existing section', () => {
        (0, teach_store_1.saveProfileSection)('coding_style', 'Original', { original: 'Original' }, 85);
        (0, teach_store_1.saveProfileSection)('coding_style', 'Updated', { updated: 'Updated' }, 90);
        const section = (0, teach_store_1.getProfileSection)('coding_style');
        expect(section.rawText).toBe('Updated');
        expect(section.importance).toBe(90);
    });
    it('deletes a section', () => {
        (0, teach_store_1.saveProfileSection)('coding_style', 'Test', { test: 'Test' }, 85);
        expect((0, teach_store_1.profileExists)()).toBe(true);
        (0, teach_store_1.deleteSection)('coding_style');
        expect((0, teach_store_1.profileExists)()).toBe(false);
    });
    it('resets profile', () => {
        (0, teach_store_1.saveProfileSection)('coding_style', 'Test', { test: 'Test' }, 85);
        (0, teach_store_1.saveProfileSection)('hates', 'Test', { test: 'Test' }, 85);
        expect((0, teach_store_1.profileExists)()).toBe(true);
        (0, teach_store_1.deleteProfile)();
        expect((0, teach_store_1.profileExists)()).toBe(false);
    });
    it('returns completion status', () => {
        const allSections = ['coding_style', 'ai_expectations', 'hates', 'project_rules', 'workflow', 'communication', 'problems', 'notes'];
        (0, teach_store_1.saveProfileSection)('coding_style', 'Test', { test: 'Test' }, 85);
        (0, teach_store_1.saveProfileSection)('hates', 'Test', { test: 'Test' }, 85);
        const status = (0, teach_store_1.profileCompletionStatus)(allSections);
        expect(status.done.length).toBe(2);
        expect(status.pending.length).toBe(6);
        expect(status.total).toBe(8);
        expect(status.completionPercent).toBe(25);
    });
    it('returns empty profile when no sections', () => {
        const profile = (0, teach_store_1.getFullProfile)();
        expect(Object.keys(profile).length).toBe(0);
    });
    it('returns null for non-existent section', () => {
        const section = (0, teach_store_1.getProfileSection)('nonexistent');
        expect(section).toBeNull();
    });
});
//# sourceMappingURL=teach-store.test.js.map