From e9a2baf2a22810d3d727184454af50d5301a44cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20Moreau?= <cem.moreau@gmail.com>
Date: Wed, 13 Jul 2022 14:43:20 +0200
Subject: [PATCH] tests(pallet-ud): joiner comes after reevaluations (!89)

* test: joiner comes after reevaluations
---
 pallets/universal-dividend/src/compute_claim_uds.rs | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/pallets/universal-dividend/src/compute_claim_uds.rs b/pallets/universal-dividend/src/compute_claim_uds.rs
index 02b381603..8172ca171 100644
--- a/pallets/universal-dividend/src/compute_claim_uds.rs
+++ b/pallets/universal-dividend/src/compute_claim_uds.rs
@@ -96,4 +96,17 @@ mod tests {
             (1, 1_000)
         );
     }
+
+    #[test]
+    fn ud_for_joiner_after_reeval() {
+        let past_reevals = vec![
+            (1, 1_000 as Balance),
+            (2, 10_000 as Balance),
+            (3, 100_000 as Balance),
+        ];
+        assert_eq!(
+            compute_claim_uds(4, 2, past_reevals.into_iter()),
+            (2, 110_000)
+        );
+    }
 }
-- 
GitLab