|
|
|
@ -57,4 +57,23 @@ describe('GfHistoricalMarketDataEditorComponent', () => { |
|
|
|
expect(component.formatDay(31)).toBe('31'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
describe('ngOnChanges', () => { |
|
|
|
afterEach(() => { |
|
|
|
jest.useRealTimers(); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should keep the market price of today if the last item is in the future', () => { |
|
|
|
jest.useFakeTimers().setSystemTime(new Date(2026, 10, 29, 20)); |
|
|
|
|
|
|
|
fixture.componentRef.setInput('marketData', [ |
|
|
|
{ date: new Date(2026, 10, 29), marketPrice: 1 }, |
|
|
|
{ date: new Date(2026, 10, 30), marketPrice: 2 } |
|
|
|
]); |
|
|
|
|
|
|
|
fixture.detectChanges(); |
|
|
|
|
|
|
|
expect(component.marketDataByMonth['2026-11']['29'].marketPrice).toBe(1); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|