openpencil/tools/architecture/tests/tool-layout.test.ts
Danila Poyarkov f2bfaba287 refactor: narrow lint policies and consolidate their support
Remove the disabled widening audit and its resolver. Fix Bun aliases and bounded reducer slices, reject parser failures in shared fixtures, and retain upstream attribution in NOTICE.
2026-09-14 10:10:27 +03:00

29 lines
965 B
TypeScript

import { expect, test } from 'bun:test'
import { join } from 'node:path'
import { openPencilArchitecturePlugin } from '../src/steiger-rules/index'
test('keeps tool test helpers beside tests without allowing arbitrary tool locations', () => {
const rule = openPencilArchitecturePlugin.ruleDefinitions.find(
(rule) => rule.name === 'open-pencil/strict-tools-layout'
)
if (!rule) throw new Error('Missing tool layout rule')
for (const [file, valid] of [
['tools/lint/src/plugin.ts', true],
['tools/lint/tests/example.test.ts', true],
['tools/lint/tests/helpers/lint.ts', true],
['tools/lint/tests/lint.ts', false],
['tools/lint/helpers/lint.ts', false],
['tools/lint/plugin.ts', false]
] as const) {
const root = process.cwd()
expect(
rule.check({
type: 'folder',
path: root,
children: [{ type: 'file', path: join(root, file) }]
}).diagnostics.length
).toBe(valid ? 0 : 1)
}
})