mirror of
https://github.com/sasjs/lint.git
synced 2025-12-11 01:44:36 +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', () => {
|
||||
it('should return an empty array when the content has the required macro option(s)', () => {
|
||||
const content = '%macro somemacro/ SECURE;'
|
||||
const config = new LintConfig({
|
||||
const contentSecure = '%macro somemacro/ SECURE;'
|
||||
const configSecure = new LintConfig({
|
||||
hasRequiredMacroOptions: true,
|
||||
requiredMacroOptions: ['SECURE']
|
||||
})
|
||||
expect(hasRequiredMacroOptions.test(content, config)).toEqual([])
|
||||
expect(hasRequiredMacroOptions.test(contentSecure, configSecure)).toEqual([])
|
||||
|
||||
const content2 = '%macro somemacro/ SECURE SRC;'
|
||||
const config2 = new LintConfig({
|
||||
const contentSecureSrc = '%macro somemacro/ SECURE SRC;'
|
||||
const configSecureSrc = new LintConfig({
|
||||
hasRequiredMacroOptions: true,
|
||||
requiredMacroOptions: ['SECURE', 'SRC']
|
||||
})
|
||||
expect(hasRequiredMacroOptions.test(content, config)).toEqual([])
|
||||
expect(hasRequiredMacroOptions.test(contentSecureSrc, configSecureSrc)).toEqual([])
|
||||
|
||||
const content3 = '%macro somemacro/ SECURE SRC;'
|
||||
const config3 = new LintConfig({
|
||||
const configEmpty = new LintConfig({
|
||||
hasRequiredMacroOptions: true,
|
||||
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', () => {
|
||||
const config = new LintConfig({
|
||||
const configSecure = new LintConfig({
|
||||
hasRequiredMacroOptions: true,
|
||||
requiredMacroOptions: ['SECURE']
|
||||
})
|
||||
|
||||
const content = '%macro somemacro(var1, var2)/minXoperator;'
|
||||
expect(hasRequiredMacroOptions.test(content, config)).toEqual([
|
||||
const contentMinXOperator = '%macro somemacro(var1, var2)/minXoperator;'
|
||||
expect(hasRequiredMacroOptions.test(contentMinXOperator, configSecure)).toEqual([
|
||||
{
|
||||
message: `Macro 'somemacro' does not contain the required option 'SECURE'`,
|
||||
lineNumber: 1,
|
||||
@@ -42,8 +41,8 @@ describe('hasRequiredMacroOptions - test', () => {
|
||||
}
|
||||
])
|
||||
|
||||
const content2 = '%macro somemacro(var1, var2)/ SE CURE;'
|
||||
expect(hasRequiredMacroOptions.test(content2, config)).toEqual([
|
||||
const contentSecureSplit = '%macro somemacro(var1, var2)/ SE CURE;'
|
||||
expect(hasRequiredMacroOptions.test(contentSecureSplit, configSecure)).toEqual([
|
||||
{
|
||||
message: `Macro 'somemacro' does not contain the required option 'SECURE'`,
|
||||
lineNumber: 1,
|
||||
@@ -53,8 +52,8 @@ describe('hasRequiredMacroOptions - test', () => {
|
||||
}
|
||||
])
|
||||
|
||||
const content3 = '%macro somemacro(var1, var2);'
|
||||
expect(hasRequiredMacroOptions.test(content3, config)).toEqual([
|
||||
const contentNoOption = '%macro somemacro(var1, var2);'
|
||||
expect(hasRequiredMacroOptions.test(contentNoOption, configSecure)).toEqual([
|
||||
{
|
||||
message: `Macro 'somemacro' does not contain the required option 'SECURE'`,
|
||||
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', () => {
|
||||
const config = new LintConfig({
|
||||
const configSrcStmt = new LintConfig({
|
||||
hasRequiredMacroOptions: true,
|
||||
requiredMacroOptions: ['SRC', 'STMT'],
|
||||
severityLevel: { hasRequiredMacroOptions: 'warn' }
|
||||
})
|
||||
const content = '%macro somemacro(var1, var2)/minXoperator;'
|
||||
expect(hasRequiredMacroOptions.test(content, config)).toEqual([
|
||||
const contentMinXOperator = '%macro somemacro(var1, var2)/minXoperator;'
|
||||
expect(hasRequiredMacroOptions.test(contentMinXOperator, configSrcStmt)).toEqual([
|
||||
{
|
||||
message: `Macro 'somemacro' does not contain the required option 'SRC'`,
|
||||
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', () => {
|
||||
const config = new LintConfig({
|
||||
const configSrcStmt = new LintConfig({
|
||||
hasRequiredMacroOptions: true,
|
||||
requiredMacroOptions: ['SRC', 'STMT'],
|
||||
severityLevel: { hasRequiredMacroOptions: 'error' }
|
||||
})
|
||||
const content = '%macro somemacro(var1, var2)/ SRC;'
|
||||
expect(hasRequiredMacroOptions.test(content, config)).toEqual([
|
||||
const contentSrc = '%macro somemacro(var1, var2)/ SRC;'
|
||||
expect(hasRequiredMacroOptions.test(contentSrc, configSrcStmt)).toEqual([
|
||||
{
|
||||
message: `Macro 'somemacro' does not contain the required option 'STMT'`,
|
||||
lineNumber: 1,
|
||||
|
||||
Reference in New Issue
Block a user