@@ -10,9 +10,9 @@ describe('FTSE100Parser', () => {
1010
1111 describe ( 'parse' , ( ) => {
1212 it ( 'should parse the actual FTSE CSV file correctly' , async ( ) => {
13- const result = await parser . parse ( ftseCsvFixture )
14- expect ( result ) . toBeDefined ( )
15- expect ( result ) . toEqual ( expectedFtseData )
13+ const { parsedData , result } = await parser . parse ( ftseCsvFixture )
14+ expect ( parsedData ) . toEqual ( expectedFtseData )
15+ expect ( result ) . toBe ( expectedFtseData . gbpIndex )
1616 } )
1717
1818 it ( 'should throw error for invalid CSV format' , async ( ) => {
@@ -76,13 +76,12 @@ UKX,FTSE 100 Index,100,GBP,4659.89,4926.97,4523.90
7676AS0,FTSE All-Small Index,234,GBP,4535.81973790,4918.68240124,4401.18006784
7777XXXXXXXX`
7878
79- const result = await parser . parse ( csvWithInconsistentColumns )
80- expect ( result ) . toBeDefined ( )
81- expect ( result . indexCode ) . toBe ( 'UKX' )
82- expect ( result . indexSectorName ) . toBe ( 'FTSE 100 Index' )
83- expect ( result . numberOfConstituents ) . toBe ( 100 )
84- expect ( result . indexBaseCurrency ) . toBe ( 'GBP' )
85- expect ( result . gbpIndex ) . toBe ( 4926.97 )
79+ const { parsedData } = await parser . parse ( csvWithInconsistentColumns )
80+ expect ( parsedData . indexCode ) . toBe ( 'UKX' )
81+ expect ( parsedData . indexSectorName ) . toBe ( 'FTSE 100 Index' )
82+ expect ( parsedData . numberOfConstituents ) . toBe ( 100 )
83+ expect ( parsedData . indexBaseCurrency ) . toBe ( 'GBP' )
84+ expect ( parsedData . gbpIndex ) . toBe ( 4926.97 )
8685 } )
8786 } )
8887} )
0 commit comments