@@ -48,7 +48,7 @@ describe('toon CLI', () => {
4848 indent : 2 ,
4949 } )
5050
51- expect ( output ) . toBe ( expected )
51+ expect ( output ) . toBe ( ` ${ expected } \n` )
5252 expect ( stderr ) . toMatch ( / E n c o d e d .* → .* / )
5353 } )
5454
@@ -71,7 +71,7 @@ describe('toon CLI', () => {
7171 try {
7272 const { stderr } = await runCli ( [ '--output' , 'output.toon' ] , { cwd : directory } )
7373
74- expect ( await readOutput ( directory , 'output.toon' ) ) . toBe ( encode ( data ) )
74+ expect ( await readOutput ( directory , 'output.toon' ) ) . toBe ( ` ${ encode ( data ) } \n` )
7575 expect ( stderr ) . toMatch ( / E n c o d e d .* s t d i n [ ^ \n \r \u2028 \u2029 \u2192 ] * \u2192 .* o u t p u t \. t o o n / )
7676 }
7777 finally {
@@ -87,7 +87,7 @@ describe('toon CLI', () => {
8787
8888 await runCli ( [ 'empty.json' , '--output' , 'output.toon' ] , { cwd : directory } )
8989
90- expect ( await readOutput ( directory , 'output.toon' ) ) . toBe ( encode ( data ) )
90+ expect ( await readOutput ( directory , 'output.toon' ) ) . toBe ( ` ${ encode ( data ) } \n` )
9191 } )
9292
9393 it ( 'writes a large JSON input identically to one-shot encoding' , async ( ) => {
@@ -104,13 +104,12 @@ describe('toon CLI', () => {
104104
105105 const { stderr } = await runCli ( [ 'large-input.json' , '--output' , 'output.toon' ] , { cwd : directory } )
106106
107- // Streaming has to produce byte-identical output to the one-shot `encode()`.
108107 const expected = encode ( data , {
109108 delimiter : DEFAULT_DELIMITER ,
110109 indent : 2 ,
111110 } )
112111
113- expect ( await readOutput ( directory , 'output.toon' ) ) . toBe ( expected )
112+ expect ( await readOutput ( directory , 'output.toon' ) ) . toBe ( ` ${ expected } \n` )
114113 expect ( stderr ) . toMatch ( / E n c o d e d .* → .* / )
115114 } )
116115 } )
0 commit comments