// tools/generate-tests/generators/database/test-defs.ts
// Generates TestDefinition entries for database & data layer test suites.
import { detectCaching, detectSearchEngine, hasOrm } from './detectors.js';
export function generateDatabaseTestDefs(title, testDir, _testExt, knowledge) {
    const defs = [
        {
            name: `${title} — migration: schema up/down and rollback safety`,
            type: 'integration',
            file: `${testDir}/database/`,
            description: 'Verify schema migrations run up/down cleanly and preserve data integrity',
            priority: 'critical',
            automatable: true,
        },
        {
            name: `${title} — repository: CRUD operations on ${knowledge.database}`,
            type: 'integration',
            file: `${testDir}/database/`,
            description: 'Verify create, read, update, delete operations on the data layer',
            priority: 'high',
            automatable: true,
        },
    ];
    if (hasOrm(knowledge)) {
        defs.push({
            name: `${title} — transactions and optimistic locking`,
            type: 'integration',
            file: `${testDir}/database/`,
            description: 'Verify transaction commit/rollback and optimistic locking conflict detection',
            priority: 'high',
            automatable: true,
        });
    }
    const cache = detectCaching(knowledge);
    if (cache !== null) {
        defs.push({
            name: `${title} — caching (${cache}): hit/miss, TTL, invalidation`,
            type: 'integration',
            file: `${testDir}/database/`,
            description: 'Verify cache hit/miss behavior, TTL expiration, and invalidation patterns',
            priority: 'high',
            automatable: true,
        });
    }
    const search = detectSearchEngine(knowledge);
    if (search !== null) {
        defs.push({
            name: `${title} — full-text search (${search}): indexing and query relevance`,
            type: 'integration',
            file: `${testDir}/database/`,
            description: 'Verify document indexing, query relevance ranking, and fuzzy matching',
            priority: 'medium',
            automatable: true,
        });
    }
    return defs;
}
//# sourceMappingURL=test-defs.js.map