Files
ComfyUI_frontend/tests-ui/tests/utils/migration/migrateReroute.test.ts
Christian Byrne ca312fd1ea [refactor] Improve workflow domain organization (#5584)
* [refactor] move workflow domain to its own folder

* [refactor] Fix workflow platform architecture organization

- Move workflow rendering functionality to renderer/thumbnail domain
- Rename ui folder to management for better semantic clarity
- Update all import paths to reflect proper domain boundaries
- Fix test imports to use new structure

Architecture improvements:
- rendering → renderer/thumbnail (belongs with other rendering logic)
- ui → management (better name for state management and UI integration)

This ensures proper separation of concerns and domain boundaries.

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

Co-Authored-By: Claude <noreply@anthropic.com>

* [fix] Resolve circular dependency between nodeDefStore and subgraphStore

* [fix] Update browser test imports to use new workflow platform paths

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-15 02:22:37 -07:00

38 lines
1.2 KiB
TypeScript

import fs from 'node:fs'
import path from 'node:path'
import { describe, expect, it } from 'vitest'
import type { WorkflowJSON04 } from '@/platform/workflow/validation/schemas/workflowSchema'
import { migrateLegacyRerouteNodes } from '@/utils/migration/migrateReroute'
describe('migrateReroute', () => {
describe('migrateReroute snapshots', () => {
// Helper function to load workflow JSON files
const loadWorkflow = (filePath: string): WorkflowJSON04 => {
const fullPath = path.resolve(__dirname, filePath)
const fileContent = fs.readFileSync(fullPath, 'utf-8')
return JSON.parse(fileContent) as WorkflowJSON04
}
it.each([
'branching.json',
'single_connected.json',
'floating.json',
'floating_branch.json'
])('should correctly migrate %s', (fileName) => {
// Load the legacy workflow
const legacyWorkflow = loadWorkflow(
`workflows/reroute/legacy/${fileName}`
)
// Migrate the workflow
const migratedWorkflow = migrateLegacyRerouteNodes(legacyWorkflow)
// Compare with snapshot
expect(JSON.stringify(migratedWorkflow, null, 2)).toMatchFileSnapshot(
`workflows/reroute/native/${fileName}`
)
})
})
})