@@ -39,42 +39,42 @@ describe('CSV and CLI Tests', () => {
3939 } )
4040
4141 describe ( 'CLI logs specific errors' , ( ) => {
42- it ( 'on faulty CSV format' , async ( ) => {
42+ it ( 'on faulty CSV format' , ( ) => {
4343 const csvFilePath = path . join ( samplesFolder , 'faulty-sample.csv' )
4444 const jsonFilePath = tmp . fileSync ( ) . name
4545
46- expect (
46+ return expect (
4747 exec ( `${ binPath } -i ${ csvFilePath } -o ${ jsonFilePath } -t returninfo` )
48- ) . rejects . toThrowError ( / R o w l e n g t h d o e s n o t m a t c h h e a d e r s / )
48+ ) . rejects . toThrow ( / R o w l e n g t h d o e s n o t m a t c h h e a d e r s / )
4949 } )
5050
51- it ( 'on missing return-info headers' , async ( ) => {
51+ it ( 'on missing return-info headers' , ( ) => {
5252 const csvFilePath = path . join (
5353 samplesFolder ,
5454 'return-info-error2-sample.csv'
5555 )
5656 const jsonFilePath = tmp . fileSync ( ) . name
5757
58- expect (
58+ return expect (
5959 exec ( `${ binPath } -i ${ csvFilePath } -o ${ jsonFilePath } -t returninfo` )
60- ) . rejects . toThrowError ( / R e q u i r e d h e a d e r s m i s s i n g : ' o r d e r N u m b e r ' / )
60+ ) . rejects . toThrow ( / R e q u i r e d h e a d e r s m i s s i n g : ' o r d e r N u m b e r ' / )
6161 } )
6262
63- it ( 'on missing line-item-state headers' , async ( ) => {
63+ it ( 'on missing line-item-state headers' , ( ) => {
6464 const csvFilePath = path . join ( samplesFolder , 'return-info-sample.csv' )
6565 const jsonFilePath = tmp . fileSync ( ) . name
6666
67- expect (
67+ return expect (
6868 exec ( `${ binPath } -i ${ csvFilePath } -o ${ jsonFilePath } -t lineitemstate` )
69- ) . rejects . toThrowError ( / R e q u i r e d h e a d e r s m i s s i n g : ' f r o m S t a t e , t o S t a t e ' / )
69+ ) . rejects . toThrow ( / R e q u i r e d h e a d e r s m i s s i n g : ' f r o m S t a t e , t o S t a t e ' / )
7070 } )
7171
72- it ( 'stack trace on verbose level' , async ( ) => {
72+ it ( 'stack trace on verbose level' , ( ) => {
7373 const csvFilePath = path . join ( samplesFolder , 'faulty-sample.csv' )
7474
75- expect (
75+ return expect (
7676 exec ( `${ binPath } -i ${ csvFilePath } --logLevel verbose -t returninfo` )
77- ) . rejects . toThrowError ( / E R R : R o w l e n g t h d o e s n o t m a t c h h e a d e r s / )
77+ ) . rejects . toThrow ( / E R R : R o w l e n g t h d o e s n o t m a t c h h e a d e r s / )
7878 } )
7979 } )
8080
@@ -148,16 +148,16 @@ describe('CSV and CLI Tests', () => {
148148 expect ( data ) . toMatchSnapshot ( )
149149 } )
150150
151- it ( 'CLI should log errors to stderr and log file' , async ( ) => {
151+ it ( 'CLI should log errors to stderr and log file' , ( ) => {
152152 const tmpFile = tmp . fileSync ( )
153153 const expectedError = 'Row length does not match headers'
154154 const csvFilePath = path . join ( samplesFolder , 'faulty-sample.csv' )
155155
156- expect (
156+ return expect (
157157 exec (
158158 `${ binPath } -t deliveries --inputFile ${ csvFilePath } --logFile ${ tmpFile . name } `
159159 )
160- ) . rejects . toThrowError ( expectedError )
160+ ) . rejects . toThrow ( expectedError )
161161 } )
162162 } )
163163} )
0 commit comments