1
0
mirror of https://github.com/sasjs/lint.git synced 2025-12-10 17:34:36 +00:00

test(*): removed extra lineEndings

This commit is contained in:
Saad Jutt
2021-04-21 16:51:13 +05:00
parent cd90b0850a
commit 060b838f21
5 changed files with 17 additions and 7 deletions

View File

@@ -6,7 +6,7 @@ import { LintConfig } from '../types'
describe('formatFile', () => {
it('should fix linting issues in a given file', async () => {
const content = `%macro somemacro(); \n%put 'hello';\n%mend;`
const expectedContent = `/**\n @file\n @brief <Your brief here>\n <h4> SAS Macros </h4>\n**/\n%macro somemacro();\n%put 'hello';\n%mend somemacro;\n`
const expectedContent = `/**\n @file\n @brief <Your brief here>\n <h4> SAS Macros </h4>\n**/\n%macro somemacro();\n%put 'hello';\n%mend somemacro;`
await createFile(path.join(__dirname, 'format-file-test.sas'), content)
await formatFile(path.join(__dirname, 'format-file-test.sas'))
@@ -19,7 +19,7 @@ describe('formatFile', () => {
it('should use the provided config if available', async () => {
const content = `%macro somemacro(); \n%put 'hello';\n%mend;`
const expectedContent = `/**\r\n @file\r\n @brief <Your brief here>\r\n <h4> SAS Macros </h4>\r\n**/\r\n%macro somemacro();\r\n%put 'hello';\r\n%mend somemacro;\r\n`
const expectedContent = `/**\r\n @file\r\n @brief <Your brief here>\r\n <h4> SAS Macros </h4>\r\n**/\r\n%macro somemacro();\r\n%put 'hello';\r\n%mend somemacro;`
await createFile(path.join(__dirname, 'format-file-config.sas'), content)
await formatFile(

View File

@@ -10,7 +10,7 @@ import {
describe('formatFolder', () => {
it('should fix linting issues in a given folder', async () => {
const content = `%macro somemacro(); \n%put 'hello';\n%mend;`
const expectedContent = `/**\n @file\n @brief <Your brief here>\n <h4> SAS Macros </h4>\n**/\n%macro somemacro();\n%put 'hello';\n%mend somemacro;\n`
const expectedContent = `/**\n @file\n @brief <Your brief here>\n <h4> SAS Macros </h4>\n**/\n%macro somemacro();\n%put 'hello';\n%mend somemacro;`
await createFolder(path.join(__dirname, 'format-folder-test'))
await createFile(
path.join(__dirname, 'format-folder-test', 'format-folder-test.sas'),
@@ -29,7 +29,7 @@ describe('formatFolder', () => {
it('should fix linting issues in subfolders of a given folder', async () => {
const content = `%macro somemacro(); \n%put 'hello';\n%mend;`
const expectedContent = `/**\n @file\n @brief <Your brief here>\n <h4> SAS Macros </h4>\n**/\n%macro somemacro();\n%put 'hello';\n%mend somemacro;\n`
const expectedContent = `/**\n @file\n @brief <Your brief here>\n <h4> SAS Macros </h4>\n**/\n%macro somemacro();\n%put 'hello';\n%mend somemacro;`
await createFolder(path.join(__dirname, 'format-folder-test'))
await createFolder(path.join(__dirname, 'subfolder'))
await createFile(

View File

@@ -13,7 +13,7 @@ jest.mock('../utils/getProjectRoot')
describe('formatProject', () => {
it('should format files in the current project', async () => {
const content = `%macro somemacro(); \n%put 'hello';\n%mend;`
const expectedContent = `/**\n @file\n @brief <Your brief here>\n <h4> SAS Macros </h4>\n**/\n%macro somemacro();\n%put 'hello';\n%mend somemacro;\n`
const expectedContent = `/**\n @file\n @brief <Your brief here>\n <h4> SAS Macros </h4>\n**/\n%macro somemacro();\n%put 'hello';\n%mend somemacro;`
await createFolder(path.join(__dirname, 'format-project-test'))
await createFile(
path.join(__dirname, 'format-project-test', 'format-project-test.sas'),

View File

@@ -20,7 +20,7 @@ describe('formatText', () => {
@brief <Your brief here>
<h4> SAS Macros </h4>
**/\n%macro test
%put 'hello';\n%mend test;\n`
%put 'hello';\n%mend test;`
const output = await formatText(text)
@@ -40,7 +40,7 @@ describe('formatText', () => {
)
const text = `%macro test\n %put 'hello';\r\n%mend; `
const expectedOutput = `/**\r\n @file\r\n @brief <Your brief here>\r\n <h4> SAS Macros </h4>\r\n**/\r\n%macro test\r\n %put 'hello';\r\n%mend test;\r\n`
const expectedOutput = `/**\r\n @file\r\n @brief <Your brief here>\r\n <h4> SAS Macros </h4>\r\n**/\r\n%macro test\r\n %put 'hello';\r\n%mend test;`
const output = await formatText(text)

View File

@@ -14,6 +14,8 @@ describe('parseMacros', () => {
name: 'test',
declaration: '%macro test;',
termination: '%mend',
declarationTrimmedStatement: '%macro test',
terminationTrimmedStatement: '%mend',
startLineNumber: 1,
endLineNumber: 3,
parentMacro: '',
@@ -38,6 +40,8 @@ describe('parseMacros', () => {
name: 'foo',
declaration: '%macro foo;',
termination: '%mend;',
declarationTrimmedStatement: '%macro foo',
terminationTrimmedStatement: '%mend',
startLineNumber: 1,
endLineNumber: 3,
parentMacro: '',
@@ -49,6 +53,8 @@ describe('parseMacros', () => {
name: 'bar',
declaration: '%macro bar();',
termination: '%mend bar;',
declarationTrimmedStatement: '%macro bar()',
terminationTrimmedStatement: '%mend bar',
startLineNumber: 4,
endLineNumber: 6,
parentMacro: '',
@@ -73,6 +79,8 @@ describe('parseMacros', () => {
name: 'test',
declaration: '%macro test()',
termination: '%mend test',
declarationTrimmedStatement: '%macro test()',
terminationTrimmedStatement: '%mend test',
startLineNumber: 1,
endLineNumber: 6,
parentMacro: '',
@@ -84,6 +92,8 @@ describe('parseMacros', () => {
name: 'test2',
declaration: ' %macro test2',
termination: ' %mend',
declarationTrimmedStatement: '%macro test2',
terminationTrimmedStatement: '%mend',
startLineNumber: 3,
endLineNumber: 5,
parentMacro: 'test',