summaryrefslogtreecommitdiff
path: root/tests/FundLab.Web.Tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests/FundLab.Web.Tests')
-rw-r--r--tests/FundLab.Web.Tests/BoundaryTests.fs60
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)