Skip to content

Commit

Permalink
fix: test unlimited --lineWidth`
Browse files Browse the repository at this point in the history
  • Loading branch information
ddebin committed Nov 21, 2024
1 parent cc8b275 commit 93cfe77
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/test-long-line.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
b:
c:
d: false
b: 35
a: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam nec volutpat mi, ac consectetur est. Proin venenatis tortor ut erat interdum finibus.
15 changes: 15 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@ test('CLI --lineWidth SUCCESS', (t) => {
proc.end()
})

test('CLI unlimited --lineWidth SUCCESS', (t) => {
const proc = spawn(t,
'../yaml-sort.js --input test-long-line.yml --output output.yml --lineWidth -1' +
' && cat output.yml' +
' && rm -f output.yml', opts)
proc.exitCode(0)
proc.stdout.match('a: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam nec volutpat mi, ac consectetur est. Proin venenatis tortor ut erat interdum finibus.\n' +
'b:\n' +
' b: 35\n' +
' c:\n' +
' d: false\n')
proc.stderr.match('')
proc.end()
})

test('CLI --output --stdout FAIL', (t) => {
const proc = spawn(t,
'../yaml-sort.js --input test.yml --stdout --output output.yml', opts)
Expand Down

0 comments on commit 93cfe77

Please sign in to comment.