From 060b838f218226e857eb298730dcc1e08c99d85b Mon Sep 17 00:00:00 2001 From: Saad Jutt Date: Wed, 21 Apr 2021 16:51:13 +0500 Subject: [PATCH] test(*): removed extra lineEndings --- src/format/formatFile.spec.ts | 4 ++-- src/format/formatFolder.spec.ts | 4 ++-- src/format/formatProject.spec.ts | 2 +- src/format/formatText.spec.ts | 4 ++-- src/utils/parseMacros.spec.ts | 10 ++++++++++ 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/format/formatFile.spec.ts b/src/format/formatFile.spec.ts index d4ba1b5..4581596 100644 --- a/src/format/formatFile.spec.ts +++ b/src/format/formatFile.spec.ts @@ -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 \n

SAS Macros

\n**/\n%macro somemacro();\n%put 'hello';\n%mend somemacro;\n` + const expectedContent = `/**\n @file\n @brief \n

SAS Macros

\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 \r\n

SAS Macros

\r\n**/\r\n%macro somemacro();\r\n%put 'hello';\r\n%mend somemacro;\r\n` + const expectedContent = `/**\r\n @file\r\n @brief \r\n

SAS Macros

\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( diff --git a/src/format/formatFolder.spec.ts b/src/format/formatFolder.spec.ts index 5bda372..389813b 100644 --- a/src/format/formatFolder.spec.ts +++ b/src/format/formatFolder.spec.ts @@ -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 \n

SAS Macros

\n**/\n%macro somemacro();\n%put 'hello';\n%mend somemacro;\n` + const expectedContent = `/**\n @file\n @brief \n

SAS Macros

\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 \n

SAS Macros

\n**/\n%macro somemacro();\n%put 'hello';\n%mend somemacro;\n` + const expectedContent = `/**\n @file\n @brief \n

SAS Macros

\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( diff --git a/src/format/formatProject.spec.ts b/src/format/formatProject.spec.ts index dc275eb..7f2cfa6 100644 --- a/src/format/formatProject.spec.ts +++ b/src/format/formatProject.spec.ts @@ -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 \n

SAS Macros

\n**/\n%macro somemacro();\n%put 'hello';\n%mend somemacro;\n` + const expectedContent = `/**\n @file\n @brief \n

SAS Macros

\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'), diff --git a/src/format/formatText.spec.ts b/src/format/formatText.spec.ts index 03b097b..35f2a53 100644 --- a/src/format/formatText.spec.ts +++ b/src/format/formatText.spec.ts @@ -20,7 +20,7 @@ describe('formatText', () => { @brief

SAS Macros

**/\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 \r\n

SAS Macros

\r\n**/\r\n%macro test\r\n %put 'hello';\r\n%mend test;\r\n` + const expectedOutput = `/**\r\n @file\r\n @brief \r\n

SAS Macros

\r\n**/\r\n%macro test\r\n %put 'hello';\r\n%mend test;` const output = await formatText(text) diff --git a/src/utils/parseMacros.spec.ts b/src/utils/parseMacros.spec.ts index 1367523..5aaece8 100644 --- a/src/utils/parseMacros.spec.ts +++ b/src/utils/parseMacros.spec.ts @@ -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',