removed pallet::getter from example pallets (#3371)

part of #3326 

@ggwpez @kianenigma @shawntabrizi

---------

Signed-off-by: Matteo Muraca <mmuraca247@gmail.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
Matteo Muraca
2024-02-22 00:02:31 +01:00
committed by GitHub
parent 318fed32f8
commit cd91c6b782
12 changed files with 41 additions and 36 deletions
+6 -6
View File
@@ -119,25 +119,25 @@ fn it_works_for_optional_value() {
// Check that GenesisBuilder works properly.
let val1 = 42;
let val2 = 27;
assert_eq!(Example::dummy(), Some(val1));
assert_eq!(Dummy::<Test>::get(), Some(val1));
// Check that accumulate works when we have Some value in Dummy already.
assert_ok!(Example::accumulate_dummy(RuntimeOrigin::signed(1), val2));
assert_eq!(Example::dummy(), Some(val1 + val2));
assert_eq!(Dummy::<Test>::get(), Some(val1 + val2));
// Check that accumulate works when we Dummy has None in it.
<Example as OnInitialize<u64>>::on_initialize(2);
assert_ok!(Example::accumulate_dummy(RuntimeOrigin::signed(1), val1));
assert_eq!(Example::dummy(), Some(val1 + val2 + val1));
assert_eq!(Dummy::<Test>::get(), Some(val1 + val2 + val1));
});
}
#[test]
fn it_works_for_default_value() {
new_test_ext().execute_with(|| {
assert_eq!(Example::foo(), 24);
assert_eq!(Foo::<Test>::get(), 24);
assert_ok!(Example::accumulate_foo(RuntimeOrigin::signed(1), 1));
assert_eq!(Example::foo(), 25);
assert_eq!(Foo::<Test>::get(), 25);
});
}
@@ -146,7 +146,7 @@ fn set_dummy_works() {
new_test_ext().execute_with(|| {
let test_val = 133;
assert_ok!(Example::set_dummy(RuntimeOrigin::root(), test_val.into()));
assert_eq!(Example::dummy(), Some(test_val));
assert_eq!(Dummy::<Test>::get(), Some(test_val));
});
}