1
0
mirror of https://github.com/sasjs/lint.git synced 2026-01-08 21:10:05 +00:00

feat(path-lint): add support for linting file names, add lint config schema

This commit is contained in:
Krishna Acondy
2021-03-24 19:37:51 +00:00
parent c88aa8b3f6
commit c92630a8f9
13 changed files with 237 additions and 18 deletions

View File

@@ -0,0 +1,27 @@
import { Severity } from '../types/Severity'
import { noSpacesInFileNames } from './noSpacesInFileNames'
describe('noSpacesInFileNames', () => {
it('should return an empty array when the file name has no spaces', () => {
const filePath = '/code/sas/my_sas_file.sas'
expect(noSpacesInFileNames.test(filePath)).toEqual([])
})
it('should return an empty array when the file name has no spaces, even if the containing folder has spaces', () => {
const filePath = '/code/sas projects/my_sas_file.sas'
expect(noSpacesInFileNames.test(filePath)).toEqual([])
})
it('should return an array with a single diagnostic when the file name has spaces', () => {
const filePath = '/code/sas/my sas file.sas'
expect(noSpacesInFileNames.test(filePath)).toEqual([
{
message: 'File name contains spaces',
lineNumber: 1,
startColumnNumber: 1,
endColumnNumber: 1,
severity: Severity.Warning
}
])
})
})