1
0
mirror of https://github.com/sasjs/lint.git synced 2025-12-10 17:34:36 +00:00
Files
lint/src/utils/getLintConfig.spec.ts

25 lines
763 B
TypeScript

import * as fileModule from '@sasjs/utils/file'
import { LintConfig } from '../types/LintConfig'
import { getLintConfig } from './getLintConfig'
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(3)
expect(config.lineLintRules.length).toEqual(5)
expect(config.pathLintRules.length).toEqual(2)
})
})