From f65a108436243fec2e33a0c16cfe2d5331093749 Mon Sep 17 00:00:00 2001 From: Valentin Zickner Date: Mon, 26 Jul 2021 22:23:32 +0200 Subject: [PATCH] change hardcoded timestamp in test to timezone specific --- apps/api/src/app/core/portfolio-calculator.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api/src/app/core/portfolio-calculator.spec.ts b/apps/api/src/app/core/portfolio-calculator.spec.ts index dbf323c22..5410c5f85 100644 --- a/apps/api/src/app/core/portfolio-calculator.spec.ts +++ b/apps/api/src/app/core/portfolio-calculator.spec.ts @@ -619,7 +619,7 @@ describe('PortfolioCalculator', () => { const spy = jest .spyOn(Date, 'now') - .mockImplementation(() => 1603490400000); // 2020-10-24 + .mockImplementation(() => new Date(Date.UTC(2020, 9, 24)).getTime()); // 2020-10-24 const currentPositions = await portfolioCalculator.getCurrentPositions( parse('2019-01-01', 'yyyy-MM-dd', new Date()) ); @@ -685,7 +685,7 @@ describe('PortfolioCalculator', () => { portfolioCalculator.setTransactionPoints(transactionPoints); const spy = jest .spyOn(Date, 'now') - .mockImplementation(() => 1603490400000); // 2020-10-24 + .mockImplementation(() => new Date(Date.UTC(2020, 9, 24)).getTime()); // 2020-10-24 // 2020-01-01 -> days 334 => value: VTI: 144.38+334*0.08=171.1 => 10*171.10=1711 // 2020-08-03 -> days 549 => value: VTI: 144.38+549*0.08=188.3 => 10*188.30=1883 => 1883/1711=1.100526008 - 1 = 0.100526008