blob: cede2d2f383427b7200f7d085402e3bd85e42d33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
namespace FundLab.Web.Tests
open Xunit
open FundLab.Web
module ChartTests =
[<Fact>]
let ``chart points preserve chronological order and normalize NAV values`` () =
let observations : NavObservation list =
[
{ navDate = "2026-01-01"; nav = "1.00000000"; dailyReturn = None }
{ navDate = "2026-01-02"; nav = "1.25000000"; dailyReturn = Some "25.00000000" }
{ navDate = "2026-01-03"; nav = "1.10000000"; dailyReturn = Some "-12.00000000" }
]
let points = Chart.chartPoints observations
Assert.Equal(3, points.Length)
Assert.Equal(0.0, points[0].x)
Assert.Equal(1.0, points[1].y)
Assert.Equal(0.4, points[2].y)
Assert.Equal("2026-01-03", points[2].navDate)
|