mirror of
https://github.com/sasjs/lint.git
synced 2025-12-10 17:34:36 +00:00
chore(tests): changed numeric literals -> consts
This commit is contained in:
@@ -2,13 +2,15 @@ import { lintFile } from './lintFile'
|
||||
import { Severity } from '../types/Severity'
|
||||
import path from 'path'
|
||||
|
||||
const expectedDiagnosticsCount = 9
|
||||
|
||||
describe('lintFile', () => {
|
||||
it('should identify lint issues in a given file', async () => {
|
||||
const results = await lintFile(
|
||||
path.join(__dirname, '..', 'Example File.sas')
|
||||
)
|
||||
|
||||
expect(results.length).toEqual(9)
|
||||
expect(results.length).toEqual(expectedDiagnosticsCount)
|
||||
expect(results).toContainEqual({
|
||||
message: 'Line contains trailing spaces',
|
||||
lineNumber: 1,
|
||||
|
||||
@@ -2,15 +2,18 @@ import { lintFolder } from './lintFolder'
|
||||
import { Severity } from '../types/Severity'
|
||||
import path from 'path'
|
||||
|
||||
const expectedFilesCount = 1
|
||||
const expectedDiagnosticsCount = 9
|
||||
|
||||
describe('lintFolder', () => {
|
||||
it('should identify lint issues in a given folder', async () => {
|
||||
const results = await lintFolder(path.join(__dirname, '..'))
|
||||
|
||||
expect(results.size).toEqual(1)
|
||||
expect(results.size).toEqual(expectedFilesCount)
|
||||
const diagnostics = results.get(
|
||||
path.join(__dirname, '..', 'Example File.sas')
|
||||
)!
|
||||
expect(diagnostics.length).toEqual(9)
|
||||
expect(diagnostics.length).toEqual(expectedDiagnosticsCount)
|
||||
expect(diagnostics).toContainEqual({
|
||||
message: 'Line contains trailing spaces',
|
||||
lineNumber: 1,
|
||||
|
||||
@@ -4,6 +4,9 @@ import * as utils from '../utils'
|
||||
import path from 'path'
|
||||
jest.mock('../utils')
|
||||
|
||||
const expectedFilesCount = 1
|
||||
const expectedDiagnosticsCount = 9
|
||||
|
||||
describe('lintProject', () => {
|
||||
it('should identify lint issues in a given project', async () => {
|
||||
jest
|
||||
@@ -11,11 +14,11 @@ describe('lintProject', () => {
|
||||
.mockImplementationOnce(() => Promise.resolve(path.join(__dirname, '..')))
|
||||
const results = await lintProject()
|
||||
|
||||
expect(results.size).toEqual(1)
|
||||
expect(results.size).toEqual(expectedFilesCount)
|
||||
const diagnostics = results.get(
|
||||
path.join(__dirname, '..', 'Example File.sas')
|
||||
)!
|
||||
expect(diagnostics.length).toEqual(9)
|
||||
expect(diagnostics.length).toEqual(expectedDiagnosticsCount)
|
||||
expect(diagnostics).toContainEqual({
|
||||
message: 'Line contains trailing spaces',
|
||||
lineNumber: 1,
|
||||
|
||||
@@ -2,6 +2,10 @@ import * as fileModule from '@sasjs/utils/file'
|
||||
import { LintConfig } from '../types/LintConfig'
|
||||
import { getLintConfig } from './getLintConfig'
|
||||
|
||||
const expectedFileLintRulesCount = 4
|
||||
const expectedLineLintRulesCount = 5
|
||||
const expectedPathLintRulesCount = 2
|
||||
|
||||
describe('getLintConfig', () => {
|
||||
it('should get the lint config', async () => {
|
||||
const config = await getLintConfig()
|
||||
@@ -17,8 +21,8 @@ describe('getLintConfig', () => {
|
||||
const config = await getLintConfig()
|
||||
|
||||
expect(config).toBeInstanceOf(LintConfig)
|
||||
expect(config.fileLintRules.length).toEqual(4)
|
||||
expect(config.lineLintRules.length).toEqual(5)
|
||||
expect(config.pathLintRules.length).toEqual(2)
|
||||
expect(config.fileLintRules.length).toEqual(expectedFileLintRulesCount)
|
||||
expect(config.lineLintRules.length).toEqual(expectedLineLintRulesCount)
|
||||
expect(config.pathLintRules.length).toEqual(expectedPathLintRulesCount)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user