mirror of
https://github.com/sasjs/lint.git
synced 2026-01-06 20:20:06 +00:00
fix: updated content/config variable names in tests
This commit is contained in:
@@ -3,36 +3,35 @@ import { hasRequiredMacroOptions } from './hasRequiredMacroOptions'
|
|||||||
|
|
||||||
describe('hasRequiredMacroOptions - test', () => {
|
describe('hasRequiredMacroOptions - test', () => {
|
||||||
it('should return an empty array when the content has the required macro option(s)', () => {
|
it('should return an empty array when the content has the required macro option(s)', () => {
|
||||||
const content = '%macro somemacro/ SECURE;'
|
const contentSecure = '%macro somemacro/ SECURE;'
|
||||||
const config = new LintConfig({
|
const configSecure = new LintConfig({
|
||||||
hasRequiredMacroOptions: true,
|
hasRequiredMacroOptions: true,
|
||||||
requiredMacroOptions: ['SECURE']
|
requiredMacroOptions: ['SECURE']
|
||||||
})
|
})
|
||||||
expect(hasRequiredMacroOptions.test(content, config)).toEqual([])
|
expect(hasRequiredMacroOptions.test(contentSecure, configSecure)).toEqual([])
|
||||||
|
|
||||||
const content2 = '%macro somemacro/ SECURE SRC;'
|
const contentSecureSrc = '%macro somemacro/ SECURE SRC;'
|
||||||
const config2 = new LintConfig({
|
const configSecureSrc = new LintConfig({
|
||||||
hasRequiredMacroOptions: true,
|
hasRequiredMacroOptions: true,
|
||||||
requiredMacroOptions: ['SECURE', 'SRC']
|
requiredMacroOptions: ['SECURE', 'SRC']
|
||||||
})
|
})
|
||||||
expect(hasRequiredMacroOptions.test(content, config)).toEqual([])
|
expect(hasRequiredMacroOptions.test(contentSecureSrc, configSecureSrc)).toEqual([])
|
||||||
|
|
||||||
const content3 = '%macro somemacro/ SECURE SRC;'
|
const configEmpty = new LintConfig({
|
||||||
const config3 = new LintConfig({
|
|
||||||
hasRequiredMacroOptions: true,
|
hasRequiredMacroOptions: true,
|
||||||
requiredMacroOptions: ['']
|
requiredMacroOptions: ['']
|
||||||
})
|
})
|
||||||
expect(hasRequiredMacroOptions.test(content, config)).toEqual([])
|
expect(hasRequiredMacroOptions.test(contentSecureSrc, configEmpty)).toEqual([])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return an array with a single diagnostic when Macro does not contain the required option', () => {
|
it('should return an array with a single diagnostic when Macro does not contain the required option', () => {
|
||||||
const config = new LintConfig({
|
const configSecure = new LintConfig({
|
||||||
hasRequiredMacroOptions: true,
|
hasRequiredMacroOptions: true,
|
||||||
requiredMacroOptions: ['SECURE']
|
requiredMacroOptions: ['SECURE']
|
||||||
})
|
})
|
||||||
|
|
||||||
const content = '%macro somemacro(var1, var2)/minXoperator;'
|
const contentMinXOperator = '%macro somemacro(var1, var2)/minXoperator;'
|
||||||
expect(hasRequiredMacroOptions.test(content, config)).toEqual([
|
expect(hasRequiredMacroOptions.test(contentMinXOperator, configSecure)).toEqual([
|
||||||
{
|
{
|
||||||
message: `Macro 'somemacro' does not contain the required option 'SECURE'`,
|
message: `Macro 'somemacro' does not contain the required option 'SECURE'`,
|
||||||
lineNumber: 1,
|
lineNumber: 1,
|
||||||
@@ -42,8 +41,8 @@ describe('hasRequiredMacroOptions - test', () => {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
const content2 = '%macro somemacro(var1, var2)/ SE CURE;'
|
const contentSecureSplit = '%macro somemacro(var1, var2)/ SE CURE;'
|
||||||
expect(hasRequiredMacroOptions.test(content2, config)).toEqual([
|
expect(hasRequiredMacroOptions.test(contentSecureSplit, configSecure)).toEqual([
|
||||||
{
|
{
|
||||||
message: `Macro 'somemacro' does not contain the required option 'SECURE'`,
|
message: `Macro 'somemacro' does not contain the required option 'SECURE'`,
|
||||||
lineNumber: 1,
|
lineNumber: 1,
|
||||||
@@ -53,8 +52,8 @@ describe('hasRequiredMacroOptions - test', () => {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
const content3 = '%macro somemacro(var1, var2);'
|
const contentNoOption = '%macro somemacro(var1, var2);'
|
||||||
expect(hasRequiredMacroOptions.test(content3, config)).toEqual([
|
expect(hasRequiredMacroOptions.test(contentNoOption, configSecure)).toEqual([
|
||||||
{
|
{
|
||||||
message: `Macro 'somemacro' does not contain the required option 'SECURE'`,
|
message: `Macro 'somemacro' does not contain the required option 'SECURE'`,
|
||||||
lineNumber: 1,
|
lineNumber: 1,
|
||||||
@@ -66,13 +65,13 @@ describe('hasRequiredMacroOptions - test', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should return an array with a two diagnostics when Macro does not contain the required options', () => {
|
it('should return an array with a two diagnostics when Macro does not contain the required options', () => {
|
||||||
const config = new LintConfig({
|
const configSrcStmt = new LintConfig({
|
||||||
hasRequiredMacroOptions: true,
|
hasRequiredMacroOptions: true,
|
||||||
requiredMacroOptions: ['SRC', 'STMT'],
|
requiredMacroOptions: ['SRC', 'STMT'],
|
||||||
severityLevel: { hasRequiredMacroOptions: 'warn' }
|
severityLevel: { hasRequiredMacroOptions: 'warn' }
|
||||||
})
|
})
|
||||||
const content = '%macro somemacro(var1, var2)/minXoperator;'
|
const contentMinXOperator = '%macro somemacro(var1, var2)/minXoperator;'
|
||||||
expect(hasRequiredMacroOptions.test(content, config)).toEqual([
|
expect(hasRequiredMacroOptions.test(contentMinXOperator, configSrcStmt)).toEqual([
|
||||||
{
|
{
|
||||||
message: `Macro 'somemacro' does not contain the required option 'SRC'`,
|
message: `Macro 'somemacro' does not contain the required option 'SRC'`,
|
||||||
lineNumber: 1,
|
lineNumber: 1,
|
||||||
@@ -91,13 +90,13 @@ describe('hasRequiredMacroOptions - test', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should return an array with a one diagnostic when Macro contains 1 of 2 required options', () => {
|
it('should return an array with a one diagnostic when Macro contains 1 of 2 required options', () => {
|
||||||
const config = new LintConfig({
|
const configSrcStmt = new LintConfig({
|
||||||
hasRequiredMacroOptions: true,
|
hasRequiredMacroOptions: true,
|
||||||
requiredMacroOptions: ['SRC', 'STMT'],
|
requiredMacroOptions: ['SRC', 'STMT'],
|
||||||
severityLevel: { hasRequiredMacroOptions: 'error' }
|
severityLevel: { hasRequiredMacroOptions: 'error' }
|
||||||
})
|
})
|
||||||
const content = '%macro somemacro(var1, var2)/ SRC;'
|
const contentSrc = '%macro somemacro(var1, var2)/ SRC;'
|
||||||
expect(hasRequiredMacroOptions.test(content, config)).toEqual([
|
expect(hasRequiredMacroOptions.test(contentSrc, configSrcStmt)).toEqual([
|
||||||
{
|
{
|
||||||
message: `Macro 'somemacro' does not contain the required option 'STMT'`,
|
message: `Macro 'somemacro' does not contain the required option 'STMT'`,
|
||||||
lineNumber: 1,
|
lineNumber: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user