1616
1717import { CbuildRunReader } from './cbuild-run-reader' ;
1818
19- const TEST_CBUILD_RUN_FILE = 'test-data/multi-core .cbuild-run.yml' ; // Relative to repo root
19+ const TEST_CBUILD_RUN_FILE = 'test-data/simple .cbuild-run.yml' ; // Relative to repo root
2020const TEST_FILE_PATH = 'test-data/fileReaderTest.txt' ; // Relative to repo root
2121
2222describe ( 'CbuildRunReader' , ( ) => {
@@ -31,19 +31,25 @@ describe('CbuildRunReader', () => {
3131 expect ( contents ) . toMatchSnapshot ( ) ;
3232 } ) ;
3333
34- it ( 'throws if it parses something other than a *.cbuild-run.yml file' , async ( ) => {
34+ it ( 'throws if it parses something other than a *.cbuild-run.yml file and correctly responds to raw contents calls ' , async ( ) => {
3535 const expectedError = / I n v a l i d ' \* \. c b u i l d - r u n \. y m l ' f i l e : .* t e s t - d a t a \/ f i l e R e a d e r T e s t \. t x t / ;
3636 const cbuildRunReader = new CbuildRunReader ( ) ;
3737 await expect ( cbuildRunReader . parse ( TEST_FILE_PATH ) ) . rejects . toThrow ( expectedError ) ;
3838 expect ( cbuildRunReader . hasContents ( ) ) . toBe ( false ) ;
3939 expect ( cbuildRunReader . getContents ( ) ) . toBeUndefined ( ) ;
4040 } ) ;
41+
42+ it ( 'correctly responds to raw contents calls if nothing is parsed' , ( ) => {
43+ const cbuildRunReader = new CbuildRunReader ( ) ;
44+ expect ( cbuildRunReader . hasContents ( ) ) . toBe ( false ) ;
45+ expect ( cbuildRunReader . getContents ( ) ) . toBeUndefined ( ) ;
46+ } ) ;
4147 } ) ;
4248
4349 describe ( 'Extract Values' , ( ) => {
4450 let cbuildRunReader : CbuildRunReader ;
4551
46- beforeAll ( async ( ) => {
52+ beforeEach ( ( ) => {
4753 cbuildRunReader = new CbuildRunReader ( ) ;
4854 } ) ;
4955
@@ -54,5 +60,9 @@ describe('CbuildRunReader', () => {
5460 expect ( svdFilePaths ) . toEqual ( expectedSvdFilePaths ) ;
5561 } ) ;
5662
63+ it ( 'returns empty SVD file path list if nothing is parsed' , ( ) => {
64+ const svdFilePaths = cbuildRunReader . getSvdFilePaths ( '/my/pack/root' ) ;
65+ expect ( svdFilePaths . length ) . toEqual ( 0 ) ;
66+ } ) ;
5767 } ) ;
5868} ) ;
0 commit comments