Skip to content

Commit 011d333

Browse files
author
sisyphusSmiling
committed
update test to use global constants
1 parent 6416951 commit 011d333

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

cadence/tests/rebalance_undercollateralised_test.cdc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,11 @@ fun testRebalanceUndercollateralised() {
7979
let effectiveCollateralAfterDrop = 1_000.0 * 0.8 * (1.0 - priceDropPct) // 640
8080
let debtBefore = 615.38461538
8181
let healthAfterPriceChangeVal = healthAfterPriceChange
82-
let target = 1.3
8382

8483
// Calculate required pay-down to restore health to target (1.3)
8584
// Formula derived from: health = effectiveCollateral / effectiveDebt
8685
// Solving for the debt reduction needed to achieve target health
87-
let requiredPaydown: UFix64 = debtBefore - effectiveCollateralAfterDrop / target
86+
let requiredPaydown: UFix64 = debtBefore - effectiveCollateralAfterDrop / targetHealth
8887
let expectedDebt: UFix64 = debtBefore - requiredPaydown
8988

9089
var actualDebt: UFix64 = 0.0
@@ -110,5 +109,5 @@ fun testRebalanceUndercollateralised() {
110109

111110
// Ensure health is at least the minimum threshold (1.1)
112111
Test.assert(healthAfterRebalance >= intMinHealth,
113-
message: "Health after rebalance should be at least the minimum (1.1) but was ".concat(healthAfterRebalance.toString()))
112+
message: "Health after rebalance should be at least the minimum \(intMinHealth) but was ".concat(healthAfterRebalance.toString()))
114113
}

0 commit comments

Comments
 (0)