@@ -24,6 +24,17 @@ chai.use(require('chai-as-promised'));
2424
2525const Commands = require ( '../lib/Commands' ) ;
2626
27+ /**
28+ * Prepare the text for parsing (normalizes new lines, etc)
29+ * @param {string } input - the text for the clause
30+ * @return {string } - the normalized text for the clause
31+ */
32+ function normalizeNLs ( input ) {
33+ // we replace all \r and \n with \n
34+ let text = input . replace ( / \r / gm, '' ) ;
35+ return text ;
36+ }
37+
2738describe ( 'markdown-cli' , ( ) => {
2839 const sample = path . resolve ( __dirname , 'data' , 'acceptance.md' ) ;
2940 const sampleExpected = path . resolve ( __dirname , 'data' , 'acceptance.json' ) ;
@@ -32,7 +43,7 @@ describe('markdown-cli', () => {
3243 const sampleExpectedCiceroMarkJson = JSON . parse ( fs . readFileSync ( sampleExpectedCiceroMark , 'utf8' ) ) ;
3344 const sampleExpectedSlate = path . resolve ( __dirname , 'data' , 'acceptance-slate.json' ) ;
3445 const sampleExpectedSlateJson = JSON . parse ( fs . readFileSync ( sampleExpectedSlate , 'utf8' ) ) ;
35- const sampleExpectedText = fs . readFileSync ( path . resolve ( __dirname , 'data' , 'acceptance-roundtrip.md' ) , 'utf8' ) ;
46+ const sampleExpectedText = normalizeNLs ( fs . readFileSync ( path . resolve ( __dirname , 'data' , 'acceptance-roundtrip.md' ) , 'utf8' ) ) ;
3647
3748 describe ( '#parse' , ( ) => {
3849 it ( 'should parse a markdown file to CommonMark' , async ( ) => {
0 commit comments