test: update tests for v2.28.5 behavior changes (v2.28.6) (#470)

- Update n8n-version tests: 'v' prefix now supported in version strings
- Update n8n-validation tests: empty settings now return minimal defaults
  { executionOrder: 'v1' } instead of {} to avoid API rejection (Issue #431)

Conceived by Romuald Członkowski - https://www.aiadvisors.pl/en

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

Co-authored-by: Romuald Członkowski <romualdczlonkowski@MacBook-Pro-Romuald.local>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Romuald Członkowski
2025-12-05 13:38:06 +01:00
committed by GitHub
parent 90407f845d
commit 60479e0eb4
16 changed files with 86 additions and 36 deletions

View File

@@ -391,8 +391,8 @@ describe('n8n-validation', () => {
} as any;
const cleaned = cleanWorkflowForUpdate(workflow);
// n8n API now accepts empty settings {} - server preserves existing values
expect(cleaned.settings).toEqual({});
// Empty settings get minimal defaults to avoid API rejection (Issue #431)
expect(cleaned.settings).toEqual({ executionOrder: 'v1' });
});
it('should filter settings to safe properties to prevent API errors (Issue #248 - final fix)', () => {
@@ -489,11 +489,11 @@ describe('n8n-validation', () => {
} as any;
const cleaned = cleanWorkflowForUpdate(workflow);
// n8n API now accepts empty settings {} - server preserves existing values
expect(cleaned.settings).toEqual({});
// Empty settings get minimal defaults to avoid API rejection (Issue #431)
expect(cleaned.settings).toEqual({ executionOrder: 'v1' });
});
it('should return empty settings when only non-whitelisted properties exist (Issue #431)', () => {
it('should return minimal defaults when only non-whitelisted properties exist (Issue #431)', () => {
const workflow = {
name: 'Test Workflow',
nodes: [],
@@ -1410,8 +1410,8 @@ describe('n8n-validation', () => {
expect(forUpdate).not.toHaveProperty('active');
expect(forUpdate).not.toHaveProperty('tags');
expect(forUpdate).not.toHaveProperty('meta');
// n8n API now accepts empty settings {} - server preserves existing values
expect(forUpdate.settings).toEqual({});
// Empty settings get minimal defaults to avoid API rejection (Issue #431)
expect(forUpdate.settings).toEqual({ executionOrder: 'v1' });
expect(validateWorkflowStructure(forUpdate)).toEqual([]);
});
});

View File

@@ -55,7 +55,16 @@ describe('n8n-version', () => {
expect(parseVersion('invalid')).toBeNull();
expect(parseVersion('')).toBeNull();
expect(parseVersion('1.2')).toBeNull();
expect(parseVersion('v1.2.3')).toBeNull(); // No 'v' prefix support
});
it('should handle v prefix in version strings', () => {
const result = parseVersion('v1.2.3');
expect(result).toEqual({
version: 'v1.2.3',
major: 1,
minor: 2,
patch: 3,
});
});
});