diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-22 05:23:52 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-22 05:23:52 +0800 |
| commit | 6abd4c206fbfe8369b3fde4c905619d08f13c5d1 (patch) | |
| tree | f53ce1746591b640f78cd11d63c8411160059d98 /tests/FundLab.Web.Tests | |
| parent | 545f2a507fd0138f7fd50ed7fb2631d0273db625 (diff) | |
| download | fund-lab-6abd4c206fbfe8369b3fde4c905619d08f13c5d1.tar.gz | |
Add SIP plan pause/resume and rebalance plan archive lifecycle (3d-24)
Diffstat (limited to 'tests/FundLab.Web.Tests')
| -rw-r--r-- | tests/FundLab.Web.Tests/BoundaryTests.fs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/FundLab.Web.Tests/BoundaryTests.fs b/tests/FundLab.Web.Tests/BoundaryTests.fs index d8bb472..4c05f37 100644 --- a/tests/FundLab.Web.Tests/BoundaryTests.fs +++ b/tests/FundLab.Web.Tests/BoundaryTests.fs @@ -1164,6 +1164,36 @@ module SipBoundaryTests = Assert.Equal(1, staleList.sipPlans.Length) + [<Fact>] + let ``sip pause completion updates the matching plan row status`` () = + let model = + { init () with + token = "qa-token" + createdFund = Some(sampleFund ()) + sipStatusSeq = 1 + sipStatusInFlight = true + sipPlans = [ Api.decodeSipPlan (sampleSipRaw ()) ] } + + let pausedRaw = { sampleSipRaw () with status = "paused" } + let updated, _ = update (SipPlanStatusChanged(1, pausedRaw)) model + + Assert.Equal("paused", updated.sipPlans[0].status) + Assert.False(updated.sipStatusInFlight) + + [<Fact>] + let ``sip pause failure clears in-flight and surfaces a message`` () = + let model = + { init () with + token = "qa-token" + createdFund = Some(sampleFund ()) + sipStatusSeq = 1 + sipStatusInFlight = true } + + let updated, _ = update (SipPlanStatusChangeFailed(1, "sip plan does not belong to this fund")) model + + Assert.Equal(Some "sip plan does not belong to this fund", updated.error) + Assert.False(updated.sipStatusInFlight) + module RebalanceBoundaryTests = open Xunit @@ -1249,3 +1279,33 @@ module RebalanceBoundaryTests = Assert.True(stale.rebalExecuteInFlight) Assert.Equal(None, stale.rebalResult) + + [<Fact>] + let ``rebalance archive completion updates the matching plan row status`` () = + let model = + { init () with + token = "qa-token" + createdFund = Some(sampleFundInfo ()) + rebalArchiveSeq = 1 + rebalArchiveInFlight = true + rebalPlans = [ Api.decodeRebalancePlan (sampleRebalanceRaw ()) ] } + + let archivedRaw = { sampleRebalanceRaw () with status = "archived" } + let updated, _ = update (RebalancePlanArchived(1, archivedRaw)) model + + Assert.Equal("archived", updated.rebalPlans[0].status) + Assert.False(updated.rebalArchiveInFlight) + + [<Fact>] + let ``rebalance archive failure clears in-flight and surfaces a message`` () = + let model = + { init () with + token = "qa-token" + createdFund = Some(sampleFundInfo ()) + rebalArchiveSeq = 1 + rebalArchiveInFlight = true } + + let updated, _ = update (RebalancePlanArchiveFailed(1, "rebalance plan does not belong to this fund")) model + + Assert.Equal(Some "rebalance plan does not belong to this fund", updated.error) + Assert.False(updated.rebalArchiveInFlight) |
