From 0deb8be5444f03f74ea3970e160dd7e9a2ee3f54 Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Sun, 29 Dec 2024 15:06:40 +0100
Subject: [PATCH] test: unclaimed UDs out of UD reeval window

---
 .../universal-dividend/src/compute_claim_uds.rs   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/pallets/universal-dividend/src/compute_claim_uds.rs b/pallets/universal-dividend/src/compute_claim_uds.rs
index 7d58edcea..231aac883 100644
--- a/pallets/universal-dividend/src/compute_claim_uds.rs
+++ b/pallets/universal-dividend/src/compute_claim_uds.rs
@@ -109,4 +109,19 @@ mod tests {
             (2, 110_000)
         );
     }
+
+    #[test]
+    fn very_old_unclaimed_ud_out_of_reevals() {
+        let past_reevals = vec![
+            // (3, 100 as Balance), "old" reeval which has gone out of reevals window.
+            (4, 1_000 as Balance),
+            (5, 10_000 as Balance),
+            (6, 100_000 as Balance),
+        ];
+        // All the UDs out of the reeval window must produce 0 money units
+        assert_eq!(
+            compute_claim_uds(7, 1, past_reevals.into_iter()),
+            (3, 111_000)
+        );
+    }
 }
-- 
GitLab