import { describe, expect, test } from 'bun:test' import { dynamicClassDiagnostics, vueTemplateGuardrailDiagnostics } from '../src/steiger-rules/dynamic-tailwind-classes' function component(classBinding: string) { return `` } describe('Vue template UI guardrails', () => { test('reports use*UI calls inside bindings', () => { const source = `` expect(vueTemplateGuardrailDiagnostics('src/components/Test.vue', source)).toHaveLength(1) }) test('reports raw SVG elements and permits icon components', () => { expect( vueTemplateGuardrailDiagnostics( 'src/components/Test.vue', '' ) ).toHaveLength(1) }) }) describe('dynamic Tailwind state classes', () => { test('reports conditional utility strings', () => { const diagnostics = dynamicClassDiagnostics( 'src/components/example/ExampleButton.vue', component("active ? 'bg-accent text-white' : 'text-muted'") ) expect(diagnostics).toHaveLength(1) }) test('reports object-style utility maps', () => { const diagnostics = dynamicClassDiagnostics( 'src/components/example/ExampleButton.vue', component("{ 'opacity-50': disabled }") ) expect(diagnostics).toHaveLength(1) }) test('rejects dynamic utility state in previously audited files', () => { const audited = `` expect( dynamicClassDiagnostics('src/components/CollabPanel/CollabAvatarStack.vue', audited) ).toHaveLength(1) expect( dynamicClassDiagnostics( 'src/components/LayersPanel.vue', component("active ? 'bg-hover' : 'text-muted'") ) ).toHaveLength(1) }) test('allows resolved theme slots and semantic state', () => { const source = `` expect(dynamicClassDiagnostics('src/components/example/ExampleButton.vue', source)).toEqual([]) }) test('ignores static classes', () => { expect( dynamicClassDiagnostics( 'src/components/example/ExampleButton.vue', '' ) ).toEqual([]) }) })