git.delta.rocks / unique-network / refs/commits / 2ddc70da9e1d

difftreelog

source

pallets/template/src/tests.rs729 Bsourcehistory
1// Tests to be written here23use crate::{Error, mock::*};4use frame_support::{assert_ok, assert_noop};56#[test]7fn it_works_for_default_value() {8	new_test_ext().execute_with(|| {9		// Just a dummy test for the dummy function `do_something`10		// calling the `do_something` function with a value 4211		assert_ok!(TemplateModule::do_something(Origin::signed(1), 42));12		// asserting that the stored value is equal to what we stored13		assert_eq!(TemplateModule::something(), Some(42));14	});15}1617#[test]18fn correct_error_for_none_value() {19	new_test_ext().execute_with(|| {20		// Ensure the correct error is thrown on None value21		assert_noop!(22			TemplateModule::cause_error(Origin::signed(1)),23			Error::<Test>::NoneValue24		);25	});26}