import { describe, it, expect } from 'vitest' import { findViolations } from '../../scripts/check-design-gates.mjs' const rules = (src: string, file = 'components/x.tsx'): string[] => (findViolations(src, file) as Array<{ rule: string }>).map(v => v.rule) describe('design gates (IMS Admin refresh)', () => { it('allows the radius scale, including rounded-full', () => { expect(rules('
')).toEqual([]) }) it.each(['border-2', 'border-b-2', 'border-t-2', 'border-l-2', 'border-r-2'])('flags %s', cls => { expect(rules(`
`)).toContain('no-2px-border') }) it('accepts 1px rules', () => { expect(rules('
')).toEqual([]) }) it('flags the retired Archivo font', () => { expect(rules("import { Archivo } from 'next/font/google'")).toContain('no-archivo') }) it('flags off-palette colors but accepts remapped gray, blue and red', () => { expect(rules('

')).toContain('off-palette') expect(rules('

')).toContain('off-palette') expect(rules('

')).toEqual([]) }) it('accepts the status token classes', () => { expect(rules('')).toEqual([]) }) it('flags hard-coded hex colors, including the retired Modernist red', () => { expect(rules('

')).toContain('no-hex') expect(rules('

'quoted'

')).not.toContain('no-hex') }) it('flags centered button labels', () => { expect(rules('')).toContain('no-centered-button') }) it('flags leftovers the codemod should have replaced', () => { expect(rules('
')).toEqual(expect.arrayContaining(['no-bg-white', 'no-heavy-shadow'])) }) it('reports file and 1-based line numbers', () => { const v = findViolations('a\n
', 'components/y.tsx') expect(v[0]).toMatchObject({ file: 'components/y.tsx', line: 2, rule: 'no-2px-border' }) }) it('accepts clean on-system markup', () => { expect(rules('
')).toEqual([]) }) })