import { describe, it, expect } from 'vitest' import { DEFAULT_SETTINGS, snap, routerConfig, connectorConfig } from '@diagram/settings' describe('settings', () => { it('snaps to grid when enabled', () => { const s = { ...DEFAULT_SETTINGS, gridSize: 20, snapToGrid: true } expect(snap(23, s)).toBe(20) expect(snap(31, s)).toBe(40) }) it('does not snap when disabled', () => { const s = { ...DEFAULT_SETTINGS, snapToGrid: false } expect(snap(23, s)).toBe(23) }) it('uses a grid-aligned manhattan router', () => { const r = routerConfig({ ...DEFAULT_SETTINGS, gridSize: 16 }) expect(r.name).toBe('manhattan') expect(r.args.step).toBe(16) }) it('switches connector between jumpover arc and rounded', () => { expect(connectorConfig({ ...DEFAULT_SETTINGS, jumpover: true }).name).toBe('jumpover') expect(connectorConfig({ ...DEFAULT_SETTINGS, jumpover: false }).name).toBe('rounded') }) })