1
0
mirror of https://github.com/sasjs/lint.git synced 2025-12-10 17:34:36 +00:00
Files
lint/src/rules/path/noSpacesInFileNames.spec.ts
2021-04-07 16:34:33 +01:00

28 lines
977 B
TypeScript

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
}
])
})
})