@@ -98,9 +98,35 @@ describe('api', () => {
9898 const result = await downloadInput ( 2022 , 1 , 'ASDF' ) ;
9999 expect ( result ) . toBe ( expected ) ;
100100 } ) ;
101+
102+ test ( 'does not trim start of input' , async ( ) => {
103+ const expected = '\t1234\n5678\n9101112' ;
104+ mockFetch . mockImplementation ( ( ) =>
105+ Promise . resolve ( {
106+ ok : true ,
107+ status : 200 ,
108+ text : ( ) => Promise . resolve ( expected ) ,
109+ } )
110+ ) ;
111+ const result = await downloadInput ( 2022 , 1 , 'ASDF' ) ;
112+ expect ( result ) . toBe ( expected ) ;
113+ } ) ;
114+
115+ test ( 'trims end of input' , async ( ) => {
116+ const expected = '1234\n5678\n9101112' ;
117+ mockFetch . mockImplementation ( ( ) =>
118+ Promise . resolve ( {
119+ ok : true ,
120+ status : 200 ,
121+ text : ( ) => Promise . resolve ( `${ expected } \t\n` ) ,
122+ } )
123+ ) ;
124+ const result = await downloadInput ( 2022 , 1 , 'ASDF' ) ;
125+ expect ( result ) . toBe ( expected ) ;
126+ } ) ;
101127 } ) ;
102128
103- describe ( 'submitSolution' , ( ) => {
129+ describe ( 'submitSolution() ' , ( ) => {
104130 test . each ( [ undefined , null , '' ] ) (
105131 'throws if authentication token is: "%s"' ,
106132 async ( value ) => {
0 commit comments