mirror of
https://github.com/sasjs/lint.git
synced 2026-01-18 01:30:06 +00:00
chore(*): separate tests for test and fix functions
This commit is contained in:
@@ -2,7 +2,7 @@ import { LintConfig } from '../../types'
|
|||||||
import { Severity } from '../../types/Severity'
|
import { Severity } from '../../types/Severity'
|
||||||
import { hasDoxygenHeader } from './hasDoxygenHeader'
|
import { hasDoxygenHeader } from './hasDoxygenHeader'
|
||||||
|
|
||||||
describe('hasDoxygenHeader', () => {
|
describe('hasDoxygenHeader - test', () => {
|
||||||
it('should return an empty array when the file starts with a doxygen header', () => {
|
it('should return an empty array when the file starts with a doxygen header', () => {
|
||||||
const content = `/**
|
const content = `/**
|
||||||
@file
|
@file
|
||||||
@@ -69,7 +69,9 @@ describe('hasDoxygenHeader', () => {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('hasDoxygenHeader - fix', () => {
|
||||||
it('should not alter the text if a doxygen header is already present', () => {
|
it('should not alter the text if a doxygen header is already present', () => {
|
||||||
const content = `/**
|
const content = `/**
|
||||||
@file
|
@file
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { LintConfig } from '../../types'
|
|||||||
import { Severity } from '../../types/Severity'
|
import { Severity } from '../../types/Severity'
|
||||||
import { hasMacroNameInMend } from './hasMacroNameInMend'
|
import { hasMacroNameInMend } from './hasMacroNameInMend'
|
||||||
|
|
||||||
describe('hasMacroNameInMend', () => {
|
describe('hasMacroNameInMend - test', () => {
|
||||||
it('should return an empty array when %mend has correct macro name', () => {
|
it('should return an empty array when %mend has correct macro name', () => {
|
||||||
const content = `
|
const content = `
|
||||||
%macro somemacro();
|
%macro somemacro();
|
||||||
@@ -339,7 +339,9 @@ describe('hasMacroNameInMend', () => {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('hasMacroNameInMend - fix', () => {
|
||||||
it('should add macro name to the mend statement if not present', () => {
|
it('should add macro name to the mend statement if not present', () => {
|
||||||
const content = ` %macro somemacro;\n %put &sysmacroname;\n %mend;`
|
const content = ` %macro somemacro;\n %put &sysmacroname;\n %mend;`
|
||||||
const expectedContent = ` %macro somemacro;\n %put &sysmacroname;\n %mend somemacro;`
|
const expectedContent = ` %macro somemacro;\n %put &sysmacroname;\n %mend somemacro;`
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { LintConfig, Severity } from '../../types'
|
|||||||
import { LineEndings } from '../../types/LineEndings'
|
import { LineEndings } from '../../types/LineEndings'
|
||||||
import { lineEndings } from './lineEndings'
|
import { lineEndings } from './lineEndings'
|
||||||
|
|
||||||
describe('lineEndings', () => {
|
describe('lineEndings - test', () => {
|
||||||
it('should return an empty array when the text contains the configured line endings', () => {
|
it('should return an empty array when the text contains the configured line endings', () => {
|
||||||
const text = "%put 'hello';\n%put 'world';\n"
|
const text = "%put 'hello';\n%put 'world';\n"
|
||||||
const config = new LintConfig({ lineEndings: LineEndings.LF })
|
const config = new LintConfig({ lineEndings: LineEndings.LF })
|
||||||
@@ -101,7 +101,9 @@ describe('lineEndings', () => {
|
|||||||
severity: Severity.Warning
|
severity: Severity.Warning
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('lineEndings - fix', () => {
|
||||||
it('should transform line endings to LF', () => {
|
it('should transform line endings to LF', () => {
|
||||||
const text =
|
const text =
|
||||||
"%put 'hello';\r\n%put 'test';\r\n%put 'world';\n%put 'test2';\n%put 'world2';\r\n"
|
"%put 'hello';\r\n%put 'test';\r\n%put 'world';\n%put 'test2';\n%put 'world2';\r\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user