From 7dd0e3f42105569b6e6ec02aeeec9b5a8bbd9dd3 Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Tue, 22 Sep 2026 03:25:00 +0800 Subject: Add real AKShare stock daily history probe slice (3d-19) --- tests/FundLab.Web.Tests/BoundaryTests.fs | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'tests/FundLab.Web.Tests/BoundaryTests.fs') 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 @@ -521,6 +521,39 @@ module ConfirmationBoundaryTests = Assert.Contains("无效代码", updated.stockQuoteMessage |> Option.defaultValue "") + [] + 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) + + [] + 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) + [] let ``order decode keeps decimal strings and decodes option fields`` () = let confirmed = Api.decodeOrder (sampleConfirmedRaw ()) -- cgit v1.2.3