Files
ComfyUI_frontend/tests-ui/tests/litegraph/core/serialise.test.ts
snomiao 8bfb1009ce [style] migrate to @prettier/plugin-oxc for faster formatting
Replace @trivago/prettier-plugin-sort-imports with @prettier/plugin-oxc
and @ianvs/prettier-plugin-sort-imports for improved performance.

Changes:
- Add @prettier/plugin-oxc (Rust-based fast parser)
- Add @ianvs/prettier-plugin-sort-imports (import sorting compatible with oxc)
- Remove @trivago/prettier-plugin-sort-imports
- Update .prettierrc to use new plugins and compatible import order config
- Reformat all files with new plugin configuration

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 00:02:04 +00:00

34 lines
969 B
TypeScript

import { describe } from 'vitest'
import {
LGraph,
LGraphGroup,
LGraphNode,
type ISerialisedGraph
} from '@/lib/litegraph/src/litegraph'
import { test } from './fixtures/testExtensions'
describe('LGraph Serialisation', () => {
test('can (de)serialise node / group titles', ({ expect, minimalGraph }) => {
const nodeTitle = 'Test Node'
const groupTitle = 'Test Group'
minimalGraph.add(new LGraphNode(nodeTitle))
minimalGraph.add(new LGraphGroup(groupTitle))
expect(minimalGraph.nodes.length).toBe(1)
expect(minimalGraph.nodes[0].title).toEqual(nodeTitle)
expect(minimalGraph.groups.length).toBe(1)
expect(minimalGraph.groups[0].title).toEqual(groupTitle)
const serialised = JSON.stringify(minimalGraph.serialize())
const deserialised = JSON.parse(serialised) as ISerialisedGraph
const copied = new LGraph(deserialised)
expect(copied.nodes.length).toBe(1)
expect(copied.groups.length).toBe(1)
})
})