| import { describe, expect, test } from 'vitest' |
|
|
| import { runRule } from '../../lib/init-test' |
| import { imageFileKebabCase } from '../../lib/linting-rules/image-file-kebab-case' |
|
|
| describe(imageFileKebabCase.names.join(' - '), () => { |
| test('image file not using lowercase kebab case fails', async () => { |
| const markdown = [ |
| '# Heading', |
| '', |
| '', |
| '', |
| '', |
| '', |
| ].join('\n') |
| const result = await runRule(imageFileKebabCase, { strings: { markdown } }) |
| const errors = result.markdown |
| expect(errors.length).toBe(4) |
| expect(errors.map((error) => error.lineNumber)).toEqual([3, 4, 5, 6]) |
| expect(errors[0].errorRange).toEqual([20, 9]) |
| expect(errors[1].errorRange).toEqual([11, 10]) |
| }) |
| test('image file using lowercase kebab case passes', async () => { |
| const markdown = [''].join('\n') |
| const result = await runRule(imageFileKebabCase, { strings: { markdown } }) |
| const errors = result.markdown |
| expect(errors.length).toBe(0) |
| }) |
| }) |
|
|