mirror of
https://github.com/czlonkowski/n8n-mcp.git
synced 2026-03-26 12:13:12 +00:00
test: fix enhanced-config-validator tests for new return type
- Update tests to handle filterPropertiesByMode returning object with properties and configWithDefaults - All tests now pass successfully
This commit is contained in:
@@ -99,15 +99,15 @@ describe('EnhancedConfigValidator', () => {
|
|||||||
// Mock isPropertyVisible to return true
|
// Mock isPropertyVisible to return true
|
||||||
vi.spyOn(EnhancedConfigValidator as any, 'isPropertyVisible').mockReturnValue(true);
|
vi.spyOn(EnhancedConfigValidator as any, 'isPropertyVisible').mockReturnValue(true);
|
||||||
|
|
||||||
const filtered = EnhancedConfigValidator['filterPropertiesByMode'](
|
const result = EnhancedConfigValidator['filterPropertiesByMode'](
|
||||||
properties,
|
properties,
|
||||||
{ resource: 'message', operation: 'send' },
|
{ resource: 'message', operation: 'send' },
|
||||||
'operation',
|
'operation',
|
||||||
{ resource: 'message', operation: 'send' }
|
{ resource: 'message', operation: 'send' }
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(filtered).toHaveLength(1);
|
expect(result.properties).toHaveLength(1);
|
||||||
expect(filtered[0].name).toBe('channel');
|
expect(result.properties[0].name).toBe('channel');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle minimal validation mode', () => {
|
it('should handle minimal validation mode', () => {
|
||||||
@@ -459,7 +459,7 @@ describe('EnhancedConfigValidator', () => {
|
|||||||
// Remove the mock to test real implementation
|
// Remove the mock to test real implementation
|
||||||
vi.restoreAllMocks();
|
vi.restoreAllMocks();
|
||||||
|
|
||||||
const filtered = EnhancedConfigValidator['filterPropertiesByMode'](
|
const result = EnhancedConfigValidator['filterPropertiesByMode'](
|
||||||
properties,
|
properties,
|
||||||
{ resource: 'message', operation: 'send' },
|
{ resource: 'message', operation: 'send' },
|
||||||
'operation',
|
'operation',
|
||||||
@@ -467,9 +467,9 @@ describe('EnhancedConfigValidator', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Should include messageChannel and sharedProperty, but not userEmail
|
// Should include messageChannel and sharedProperty, but not userEmail
|
||||||
expect(filtered).toHaveLength(2);
|
expect(result.properties).toHaveLength(2);
|
||||||
expect(filtered.map(p => p.name)).toContain('messageChannel');
|
expect(result.properties.map(p => p.name)).toContain('messageChannel');
|
||||||
expect(filtered.map(p => p.name)).toContain('sharedProperty');
|
expect(result.properties.map(p => p.name)).toContain('sharedProperty');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle properties without displayOptions in operation mode', () => {
|
it('should handle properties without displayOptions in operation mode', () => {
|
||||||
@@ -487,7 +487,7 @@ describe('EnhancedConfigValidator', () => {
|
|||||||
|
|
||||||
vi.restoreAllMocks();
|
vi.restoreAllMocks();
|
||||||
|
|
||||||
const filtered = EnhancedConfigValidator['filterPropertiesByMode'](
|
const result = EnhancedConfigValidator['filterPropertiesByMode'](
|
||||||
properties,
|
properties,
|
||||||
{ resource: 'user' },
|
{ resource: 'user' },
|
||||||
'operation',
|
'operation',
|
||||||
@@ -495,9 +495,9 @@ describe('EnhancedConfigValidator', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Should include property without displayOptions
|
// Should include property without displayOptions
|
||||||
expect(filtered.map(p => p.name)).toContain('alwaysVisible');
|
expect(result.properties.map(p => p.name)).toContain('alwaysVisible');
|
||||||
// Should not include conditionalProperty (wrong resource)
|
// Should not include conditionalProperty (wrong resource)
|
||||||
expect(filtered.map(p => p.name)).not.toContain('conditionalProperty');
|
expect(result.properties.map(p => p.name)).not.toContain('conditionalProperty');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user