diff --git a/test/shared.js b/test/shared.js index e27bba2..b32d04c 100644 --- a/test/shared.js +++ b/test/shared.js @@ -89,31 +89,17 @@ X-Poedit-SourceCharset: UTF-8`; expect(folded.length).to.equal(3); }); - it('should ensure that the line never ends with a partial escaping', () => { - const line = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\'aaaaa\'aaaa'; + it('should fold the line into multiple lines with the right length', () => { + const line = Array.from({ length: 75 }, () => 'a').join('') + '\\aaaaa\\aaaa'; const folded = foldLine(line); - + expect(folded.length).to.equal(2); expect(line).to.equal(folded.join('')); expect(folded).to.deep.equal([ - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'", - "aaaaa'aaaa" + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\', + 'aaaaa\\aaaa' ]); }); - it('should fold at default length', () => { - const expected = ['Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum pretium ', - 'a nunc ac fringilla. Nulla laoreet tincidunt tincidunt. Proin tristique ', - 'vestibulum mauris non aliquam. Vivamus volutpat odio nisl, sed placerat ', - 'turpis sodales a. Vestibulum quis lectus ac elit sagittis sodales ac a ', - 'felis. Nulla iaculis, nisl ut mattis fringilla, tortor quam tincidunt ', - 'lorem, quis feugiat purus felis ut velit. Donec euismod eros ut leo ', - 'lobortis tristique.' - ]; - const folded = foldLine(expected.join('')); - expect(folded).to.deep.equal(expected); - expect(folded.length).to.equal(7); - }); - it('should force fold white space', () => { const line = 'abc def ghi'; const folded = foldLine(line, 5);