mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 22:59:14 +00:00
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>
45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import {
|
|
distributeSpace,
|
|
type SpaceRequest
|
|
} from '@/lib/litegraph/src/litegraph'
|
|
|
|
describe('distributeSpace', () => {
|
|
it('should distribute space according to minimum sizes when space is limited', () => {
|
|
const requests: SpaceRequest[] = [
|
|
{ minSize: 100 },
|
|
{ minSize: 100 },
|
|
{ minSize: 100 }
|
|
]
|
|
expect(distributeSpace(300, requests)).toEqual([100, 100, 100])
|
|
})
|
|
|
|
it('should distribute extra space equally when no maxSize', () => {
|
|
const requests: SpaceRequest[] = [{ minSize: 100 }, { minSize: 100 }]
|
|
expect(distributeSpace(400, requests)).toEqual([200, 200])
|
|
})
|
|
|
|
it('should respect maximum sizes', () => {
|
|
const requests: SpaceRequest[] = [
|
|
{ minSize: 100, maxSize: 150 },
|
|
{ minSize: 100 }
|
|
]
|
|
expect(distributeSpace(400, requests)).toEqual([150, 250])
|
|
})
|
|
|
|
it('should handle empty requests array', () => {
|
|
expect(distributeSpace(1000, [])).toEqual([])
|
|
})
|
|
|
|
it('should handle negative total space', () => {
|
|
const requests: SpaceRequest[] = [{ minSize: 100 }, { minSize: 100 }]
|
|
expect(distributeSpace(-100, requests)).toEqual([100, 100])
|
|
})
|
|
|
|
it('should handle total space smaller than minimum sizes', () => {
|
|
const requests: SpaceRequest[] = [{ minSize: 100 }, { minSize: 100 }]
|
|
expect(distributeSpace(100, requests)).toEqual([100, 100])
|
|
})
|
|
})
|