ソースを参照

content working group: test for increase_mint_capacity

Mokhtar Naamani 5 年 前
コミット
06b397fa0f
1 ファイル変更22 行追加2 行削除
  1. 22 2
      runtime-modules/content-working-group/src/tests.rs

+ 22 - 2
runtime-modules/content-working-group/src/tests.rs

@@ -2186,7 +2186,7 @@ pub fn generate_too_long_length_buffer(constraint: &InputValidationLengthConstra
 }
 
 #[test]
-fn setting_mint_capacity() {
+fn increasing_mint_capacity() {
     const MINT_CAPACITY: u64 = 50000;
 
     TestExternalitiesBuilder::<Test>::default()
@@ -2196,7 +2196,27 @@ fn setting_mint_capacity() {
                 .build(),
         )
         .build()
-        .execute_with(|| {});
+        .execute_with(|| {
+            let mint_id = ContentWorkingGroup::mint();
+            let mint = Minting::mints(mint_id);
+            assert_eq!(mint.capacity(), MINT_CAPACITY);
+
+            let increase = 25000;
+            // Increasing mint capacity
+            let expected_new_capacity = MINT_CAPACITY + increase;
+            assert_ok!(ContentWorkingGroup::increase_mint_capacity(
+                Origin::ROOT,
+                increase
+            ));
+            // Excpected event after increasing
+            assert_eq!(
+                get_last_event_or_panic(),
+                crate::RawEvent::MintCapacityIncreased(mint_id, increase, expected_new_capacity)
+            );
+            // Excpected value of capacity after increasing
+            let mint = Minting::mints(mint_id);
+            assert_eq!(mint.capacity(), expected_new_capacity);
+        });
 }
 
 #[test]