Files
lcbp3/backend/scripts/repro_phase6_analytics.ts
T
admin 544bb30277
CI / CD Pipeline / build (push) Successful in 5m56s
CI / CD Pipeline / deploy (push) Failing after 4m29s
690516:1955 204 and 302 refactor #02
2026-05-16 19:55:51 +07:00

60 lines
1.9 KiB
TypeScript

// File: scripts/repro_phase6_analytics.ts
// Reproduction script for Phase 6 AI Monitoring endpoints
// This script tests the current state before implementation
import { NestFactory } from '@nestjs/core';
import { Logger } from '@nestjs/common';
import { AppModule } from '../src/app.module';
import { AiService } from '../src/modules/ai/ai.service';
const logger = new Logger('ReproPhase6Analytics');
async function testAnalyticsEndpoint() {
const app = await NestFactory.createApplicationContext(AppModule);
const aiService = app.get(AiService);
logger.log('=== Testing T036: Analytics Summary ===');
try {
const result = await aiService.getAnalyticsSummary();
logger.log('✓ PASS: getAnalyticsSummary() exists and returned results');
// logger.debug(JSON.stringify(result, null, 2));
} catch (error: any) {
logger.error(
'✗ FAIL: getAnalyticsSummary() threw an error:',
error.message
);
process.exit(1);
}
logger.log('\n=== Testing T037: Single Audit Log Delete ===');
try {
const result = await aiService.deleteAuditLogByPublicId('test-uuid', 1);
logger.log('✓ PASS: deleteAuditLogByPublicId() exists');
} catch (error: any) {
// It might throw NotFound if test-uuid doesn't exist, which is also a form of existence proof
if (
error.message.includes('not found') ||
error.message.includes('NotFound')
) {
logger.log(
'✓ PASS: deleteAuditLogByPublicId() exists (returned NotFound as expected)'
);
} else {
logger.error(
'✗ FAIL: deleteAuditLogByPublicId() threw unexpected error:',
error.message
);
process.exit(1);
}
}
await app.close();
logger.log('\n=== Reproduction Script Complete ===');
logger.log('Both methods are verified to exist.');
}
testAnalyticsEndpoint().catch((error) => {
logger.error('Script failed:', error);
process.exit(1);
});