Add tests for scaling user fee up
@@ -611,3 +611,38 @@ fn scale_user_fee_up(provided_total_usd_fee: BigDecimal) -> BigDecimal {
scaled_one_cent_provided_fee_in_usd,
)
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_scaling_user_fee_by_two() {
+ let provided_fee = BigDecimal::from_str("0.005").unwrap();
+ let provided_fee_scaled_by_two = BigDecimal::from_str("0.01").unwrap();
+
+ let scaled_fee = scale_user_fee_up(provided_fee);
+
+ assert_eq!(provided_fee_scaled_by_two, scaled_fee);
+ }
+
+ #[test]
+ fn test_scaling_user_fee_by_one_cent() {
+ let provided_fee = BigDecimal::from_str("0.015").unwrap();
+ let provided_fee_scaled_by_cent = BigDecimal::from_str("0.025").unwrap();
+
+ let scaled_fee = scale_user_fee_up(provided_fee);
+
+ assert_eq!(provided_fee_scaled_by_cent, scaled_fee);
+ }
+
+ #[test]
+ fn test_scaling_user_fee_by_5_percent() {
+ let provided_fee = BigDecimal::from_str("0.30").unwrap();
+ let provided_fee_scaled_by_five_percent = BigDecimal::from_str("0.315").unwrap();
+
+ let scaled_fee = scale_user_fee_up(provided_fee);
+
+ assert_eq!(provided_fee_scaled_by_five_percent, scaled_fee);
+ }
+}
