openpencil/packages/scene-graph/tests/layout-guides.test.ts
Danila Poyarkov 7b9f506f4a
test: migrate Scene Graph tests into the package and gate new tests/engine files (#790)
Scene Graph unit tests move to packages/scene-graph/tests with a package-local assert helper and test type-checking; five Core- and fig-owned tests move to their owners' engine homes. check:test-homes rejects any new test under tests/engine against a reviewed baseline so the migration debt only shrinks.
2026-09-30 04:53:28 +04:00

30 lines
857 B
TypeScript

import { describe, expect, test } from 'bun:test'
import { layoutGuideLines, layoutGuideSections } from '@open-pencil/scene-graph/layout-guides'
describe('layout guide geometry bounds', () => {
test('normalizes fractional section counts', () => {
expect(
layoutGuideSections(
{ width: 100, height: 100 },
{ pattern: 'COLUMNS', count: 2.8, sectionSize: 10 }
)
).toHaveLength(2)
})
test('caps pathological section and grid line counts', () => {
expect(
layoutGuideSections(
{ width: 100, height: 100 },
{ pattern: 'COLUMNS', count: Number.MAX_SAFE_INTEGER, sectionSize: 0.001 }
)
).toHaveLength(10_000)
expect(
layoutGuideLines(
{ width: 100, height: 100 },
{ pattern: 'GRID', sectionSize: Number.MIN_VALUE }
)
).toHaveLength(20_000)
})
})