diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-22 03:25:00 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-22 03:25:00 +0800 |
| commit | 7dd0e3f42105569b6e6ec02aeeec9b5a8bbd9dd3 (patch) | |
| tree | d7374c1b4bb5308374c3386ac3768ac7209a6440 /tests/FundLab.Web.Tests/BoundaryTests.fs | |
| parent | 8c01adf05f1428bf2ada49574b25529c064da884 (diff) | |
| download | fund-lab-7dd0e3f42105569b6e6ec02aeeec9b5a8bbd9dd3.tar.gz | |
Add real AKShare stock daily history probe slice (3d-19)
Diffstat (limited to 'tests/FundLab.Web.Tests/BoundaryTests.fs')
| -rw-r--r-- | tests/FundLab.Web.Tests/BoundaryTests.fs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/FundLab.Web.Tests/BoundaryTests.fs b/tests/FundLab.Web.Tests/BoundaryTests.fs index 3001273..4714632 100644 --- a/tests/FundLab.Web.Tests/BoundaryTests.fs +++ b/tests/FundLab.Web.Tests/BoundaryTests.fs @@ -522,6 +522,39 @@ module ConfirmationBoundaryTests = Assert.Contains("无效代码", updated.stockQuoteMessage |> Option.defaultValue "") [<Fact>] + let ``stock daily completion stores ascending rows`` () = + let model = init () + + let raw : RawStockDaily = + { + code = "600519" + observations = + [| + { date = "2026-09-17"; close = "1266.98"; volume = null; amount = null } + { date = "2026-09-18"; close = "1257.12"; volume = null; amount = null } + { date = "2026-09-21"; close = "1252.57"; volume = null; amount = null } + |] + } + + let updated, _ = update (StockDailyCompleted(model.stockDailySeq, raw)) model + + Assert.Equal(3, updated.stockDaily.Length) + Assert.Equal("2026-09-17", updated.stockDaily[0].date) + Assert.Equal("1252.57", updated.stockDaily[2].close) + Assert.Equal(None, updated.stockDailyMessage) + + [<Fact>] + let ``stock daily failure shows an unavailable message without rows`` () = + let model = { init () with stockDailyInFlight = true } + + let updated, _ = + update (StockDailyFailed(model.stockDailySeq, "AKShare collector failed: no valid daily history for 999999")) model + + Assert.Empty updated.stockDaily + Assert.Contains("股票日线不可用", updated.stockDailyMessage |> Option.defaultValue "") + Assert.False(updated.stockDailyInFlight) + + [<Fact>] let ``order decode keeps decimal strings and decodes option fields`` () = let confirmed = Api.decodeOrder (sampleConfirmedRaw ()) let pending = Api.decodeOrder (samplePendingRaw ()) |
