-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-examples-output.test.ts
More file actions
66 lines (61 loc) · 2.43 KB
/
test-examples-output.test.ts
File metadata and controls
66 lines (61 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* Quick test to verify examples are shown in full
*/
import { describe, it } from 'vitest';
import { printReport } from './src/core/reporter.js';
import type { AnalysisResult } from './src/types/index.js';
describe('Example output verification', () => {
it('should show full example text in output', () => {
const longExample =
'Explore the hyntx codebase to understand: 1. How the CLI argument parsing is implemented, 2. What the main entry point functions are, 3. How the analysis results are formatted and displayed to users, 4. What configuration options are available, and 5. How the provider system works with different AI models.';
const result: AnalysisResult = {
date: '2025-01-15',
patterns: [
{
id: 'missing-context',
name: 'Missing Context',
frequency: 1,
severity: 'high',
examples: [
longExample,
'Explore this codebase to understand the documentation structure. Find: 1. All markdown files, 2. How they are organized, 3. What the main documentation entry points are, and 4. How documentation is linked together.',
],
suggestion:
'Provide relevant background information - include file paths, function names, error messages, or code snippets',
beforeAfter: {
before: 'Explore the codebase',
after: 'Explore the codebase starting with src/core/analyzer.ts',
},
},
],
stats: {
totalPrompts: 10,
promptsWithIssues: 3,
overallScore: 7,
},
topSuggestion: 'Add more context to your prompts',
};
// Capture console output
const originalLog = console.log;
let output = '';
console.log = (...args: unknown[]) => {
output += args.join(' ') + '\n';
};
try {
printReport(result);
// Verify the full example is in the output
expect(output).toContain('How the CLI argument parsing is implemented');
expect(output).toContain(
'How the provider system works with different AI models',
);
expect(output).toContain('All markdown files');
expect(output).toContain('How documentation is linked together');
// Should NOT contain truncated version
expect(output).not.toContain(
'Explore the hyntx codebase to understand: 1. How the CLI argument parsing is...',
);
} finally {
console.log = originalLog;
}
});
});