test: Phase 3 - Create comprehensive unit tests for services

- Add unit tests for ConfigValidator with 44 test cases (95.21% coverage)
- Create test templates for 7 major services:
  - PropertyFilter (23 tests)
  - ExampleGenerator (35 tests)
  - TaskTemplates (36 tests)
  - PropertyDependencies (21 tests)
  - EnhancedConfigValidator (8 tests)
  - ExpressionValidator (11 tests)
  - WorkflowValidator (9 tests)
- Fix service implementations to handle edge cases discovered during testing
- Add comprehensive testing documentation:
  - Phase 3 testing plan with priorities and timeline
  - Context documentation for quick implementation
  - Mocking strategy for complex dependencies
- All 262 tests now passing (up from 75)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
czlonkowski
2025-07-28 14:15:09 +02:00
parent 45b271c860
commit b49043171e
15 changed files with 4098 additions and 5 deletions

View File

@@ -65,7 +65,11 @@ export class EnhancedConfigValidator extends ConfigValidator {
profile,
operation: operationContext,
examples: [],
nextSteps: []
nextSteps: [],
// Ensure arrays are initialized (in case baseResult doesn't have them)
errors: baseResult.errors || [],
warnings: baseResult.warnings || [],
suggestions: baseResult.suggestions || []
};
// Apply profile-based filtering

View File

@@ -280,7 +280,7 @@ export class PropertyFilter {
const simplified: SimplifiedProperty = {
name: prop.name,
displayName: prop.displayName || prop.name,
type: prop.type,
type: prop.type || 'string', // Default to string if no type specified
description: this.extractDescription(prop),
required: prop.required || false
};
@@ -445,13 +445,14 @@ export class PropertyFilter {
private static inferEssentials(properties: any[]): FilteredProperties {
// Extract explicitly required properties
const required = properties
.filter(p => p.required === true)
.filter(p => p.name && p.required === true)
.map(p => this.simplifyProperty(p));
// Find common properties (simple, always visible, at root level)
const common = properties
.filter(p => {
return !p.required &&
return p.name && // Ensure property has a name
!p.required &&
!p.displayOptions &&
p.type !== 'collection' &&
p.type !== 'fixedCollection' &&
@@ -464,7 +465,8 @@ export class PropertyFilter {
if (required.length + common.length < 5) {
const additional = properties
.filter(p => {
return !p.required &&
return p.name && // Ensure property has a name
!p.required &&
p.displayOptions &&
Object.keys(p.displayOptions.show || {}).length === 1;
})
@@ -485,6 +487,11 @@ export class PropertyFilter {
query: string,
maxResults: number = 20
): SimplifiedProperty[] {
// Return empty array for empty query
if (!query || query.trim() === '') {
return [];
}
const lowerQuery = query.toLowerCase();
const matches: Array<{ property: any; score: number; path: string }> = [];