From aa4ae558f8252ebf6cf64487bd07cd0af7930acf Mon Sep 17 00:00:00 2001 From: Mateusz Bernacik Date: Mon, 9 Dec 2024 13:38:07 +0100 Subject: [PATCH] Corrected tests. --- .../SecurityDetailsConnector.test.ts | 54 +++++++++++++------ 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/tests/SecurityDetails/SecurityDetailsConnector.test.ts b/tests/SecurityDetails/SecurityDetailsConnector.test.ts index e1cb34d..1769810 100644 --- a/tests/SecurityDetails/SecurityDetailsConnector.test.ts +++ b/tests/SecurityDetails/SecurityDetailsConnector.test.ts @@ -47,20 +47,25 @@ export async function securityDetailsLoad ( id: 'F0GBR050DD', isin: 'GB0004460357' } - ) + ); +} - const AssetAllocationsConnector = new MC.SecurityDetailsConnector({ +export async function assetAllocationsLoad ( + api: MC.Shared.MorningstarAPIOptions +) { + const connector = new MC.SecurityDetailsConnector({ api, security: { id: 'F0GBR050DD', idType: 'MSID' - } + }, + type: 'AssetAllocations' }); - await AssetAllocationsConnector.load(); + await connector.load(); Assert.deepStrictEqual( - AssetAllocationsConnector.table.getColumnNames(), + connector.table.getColumnNames(), [ 'AssetAllocations_Type', 'AssetAllocations_MorningstarEUR3_L', @@ -69,19 +74,24 @@ export async function securityDetailsLoad ( ], 'Asset allocations table should exist of expected columns.' ); +} - const RegionalExposureConnector = new MC.SecurityDetailsConnector({ +export async function regionalExposureLoad ( + api: MC.Shared.MorningstarAPIOptions +) { + const connector = new MC.SecurityDetailsConnector({ api, security: { id: 'F0GBR050DD', idType: 'MSID' - } + }, + type: 'RegionalExposure' }); - await RegionalExposureConnector.load(); + await connector.load(); Assert.deepStrictEqual( - RegionalExposureConnector.table.getColumnNames(), + connector.table.getColumnNames(), [ 'RegionalExposure_Type', 'RegionalExposure_L_0.64368', @@ -90,19 +100,24 @@ export async function securityDetailsLoad ( ], 'Regional exposure table should exist of expected columns.' ); +} - const GlobalStockSectorBreakdownConnector = new MC.SecurityDetailsConnector({ +export async function globalStockSectorBreakdownLoad ( + api: MC.Shared.MorningstarAPIOptions +) { + const connector = new MC.SecurityDetailsConnector({ api, security: { id: 'F0GBR050DD', idType: 'MSID' - } + }, + type: 'GlobalStockSectorBreakdown' }); - await GlobalStockSectorBreakdownConnector.load(); + await connector.load(); Assert.deepStrictEqual( - GlobalStockSectorBreakdownConnector.table.getColumnNames(), + connector.table.getColumnNames(), [ 'GlobalStockSectorBreakdown_Type', 'GlobalStockSectorBreakdown_L_0.64369', @@ -111,19 +126,24 @@ export async function securityDetailsLoad ( ], 'Global stock sector breakdown table should exist of expected columns.' ); +} - const CountryExposureConnector = new MC.SecurityDetailsConnector({ +export async function countryExposureLoad ( + api: MC.Shared.MorningstarAPIOptions +) { + const connector = new MC.SecurityDetailsConnector({ api, security: { id: 'F0GBR050DD', idType: 'MSID' - } + }, + type: 'CountryExposure' }); - await CountryExposureConnector.load(); + await connector.load(); Assert.deepStrictEqual( - CountryExposureConnector.table.getColumnNames(), + connector.table.getColumnNames(), [ 'CountryExposure_Type', 'CountryExposure_Bond_L_99.98311',