mirror of
https://github.com/sasjs/lint.git
synced 2025-12-10 17:34:36 +00:00
29 lines
950 B
TypeScript
29 lines
950 B
TypeScript
import * as fileModule from '@sasjs/utils/file'
|
|
import { LintConfig } from '../types/LintConfig'
|
|
import { getLintConfig } from './getLintConfig'
|
|
|
|
const expectedFileLintRulesCount = 5
|
|
const expectedLineLintRulesCount = 6
|
|
const expectedPathLintRulesCount = 2
|
|
|
|
describe('getLintConfig', () => {
|
|
it('should get the lint config', async () => {
|
|
const config = await getLintConfig()
|
|
|
|
expect(config).toBeInstanceOf(LintConfig)
|
|
})
|
|
|
|
it('should get the default config when a .sasjslint file is unavailable', async () => {
|
|
jest
|
|
.spyOn(fileModule, 'readFile')
|
|
.mockImplementationOnce(() => Promise.reject())
|
|
|
|
const config = await getLintConfig()
|
|
|
|
expect(config).toBeInstanceOf(LintConfig)
|
|
expect(config.fileLintRules.length).toEqual(expectedFileLintRulesCount)
|
|
expect(config.lineLintRules.length).toEqual(expectedLineLintRulesCount)
|
|
expect(config.pathLintRules.length).toEqual(expectedPathLintRulesCount)
|
|
})
|
|
})
|