@@ -18,17 +18,21 @@ describe('BaseCSVExtractor', () => {
18
18
expect ( fileNameDataDirectoryExtractor . csvModule ) . not . toBeUndefined ( ) ;
19
19
expect ( fileNameDataDirectoryExtractor . csvModule . constructor . name ) . toEqual ( 'CSVFileModule' ) ;
20
20
} ) ;
21
+ test ( 'Should fail when the provided dataDirectory is not an absolute path' , ( ) => {
22
+ expect ( ( ) => new BaseCSVExtractor ( { fileName : 'example.csv' , dataDirectory : './extractors/fixtures/' } ) )
23
+ . toThrowError ( 'dataDirectory is not an absolutePath, it needs to be.' ) ;
24
+ } ) ;
21
25
test ( 'Should fail when provided only provided a fileName and no dataDirectory' , ( ) => {
22
- expect ( ( ) => new BaseCSVExtractor ( { fileName : 'example.csv' } )
23
- . toThrowError ( 'Trying to instantiate a CSVExtractor without a valid filePath, url, or fileName+dataDirectory combination' ) ) ;
26
+ expect ( ( ) => new BaseCSVExtractor ( { fileName : 'example.csv' } ) )
27
+ . toThrowError ( 'Trying to instantiate a CSVExtractor without a valid filePath, url, or fileName+dataDirectory combination' ) ;
24
28
} ) ;
25
29
test ( 'Should fail when provided only provided a dataDirectory and no fileName' , ( ) => {
26
- expect ( ( ) => new BaseCSVExtractor ( { dataDirectory : '/Users/dphelan/Development/mcode-extraction-framework/test/extractors/fixtures/' } )
27
- . toThrowError ( 'Trying to instantiate a CSVExtractor without a valid filePath, url, or fileName+dataDirectory combination' ) ) ;
30
+ expect ( ( ) => new BaseCSVExtractor ( { dataDirectory : '/Users/dphelan/Development/mcode-extraction-framework/test/extractors/fixtures/' } ) )
31
+ . toThrowError ( 'Trying to instantiate a CSVExtractor without a valid filePath, url, or fileName+dataDirectory combination' ) ;
28
32
} ) ;
29
33
test ( 'Should fail when provided none of the three options above' , ( ) => {
30
- expect ( ( ) => new BaseCSVExtractor ( { } )
31
- . toThrowError ( 'Trying to instantiate a CSVExtractor without a valid filePath, url, or fileName+dataDirectory combination' ) ) ;
34
+ expect ( ( ) => new BaseCSVExtractor ( { } ) )
35
+ . toThrowError ( 'Trying to instantiate a CSVExtractor without a valid filePath, url, or fileName+dataDirectory combination' ) ;
32
36
} ) ;
33
37
} ) ;
34
38
} ) ;
0 commit comments