git.delta.rocks / unique-network / refs/commits / 455ab69b4262

difftreelog

Fix all unit test execution

Greg Zaitsev2021-11-24parent: #a1bffc7.patch.diff
in: master

6 files changed

modifiedpallets/inflation/src/lib.rsdiffbeforeafterboth
--- a/pallets/inflation/src/lib.rs
+++ b/pallets/inflation/src/lib.rs
@@ -46,7 +46,8 @@
 pub type BalanceOf<T> =
 	<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
 
-pub const YEAR: u32 = 5_259_600;
+// pub const YEAR: u32 = 5_259_600; // 6-second block 
+pub const YEAR: u32 = 2_629_800; // 12-second block 
 pub const TOTAL_YEARS_UNTIL_FLAT: u32 = 9;
 pub const START_INFLATION_PERCENT: u32 = 10;
 pub const END_INFLATION_PERCENT: u32 = 4;
modifiedpallets/inflation/src/tests.rsdiffbeforeafterboth
before · pallets/inflation/src/tests.rs
1#![cfg(test)]2#![allow(clippy::from_over_into)]3use crate as pallet_inflation;45use frame_support::{6	traits::{Currency},7	parameter_types,8};9use frame_support::{10	traits::{OnInitialize, Everything},11};12use sp_core::H256;13use sp_runtime::{14	traits::{BlakeTwo256, IdentityLookup},15	testing::Header,16};1718type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;19type Block = frame_system::mocking::MockBlock<Test>;2021const YEAR: u64 = 5_259_600;2223parameter_types! {24	pub const ExistentialDeposit: u64 = 1;25	pub const MaxLocks: u32 = 50;26}2728impl pallet_balances::Config for Test {29	type AccountStore = System;30	type Balance = u64;31	type DustRemoval = ();32	type Event = ();33	type ExistentialDeposit = ExistentialDeposit;34	type WeightInfo = ();35	type MaxLocks = MaxLocks;36	type MaxReserves = ();37	type ReserveIdentifier = ();38}3940frame_support::construct_runtime!(41	pub enum Test where42		Block = Block,43		NodeBlock = Block,44		UncheckedExtrinsic = UncheckedExtrinsic,45	{46		Balances: pallet_balances::{Pallet, Call, Storage},47		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},48		Inflation: pallet_inflation::{Pallet, Call, Storage},49	}50);5152parameter_types! {53	pub const BlockHashCount: u64 = 250;54	pub BlockWeights: frame_system::limits::BlockWeights =55		frame_system::limits::BlockWeights::simple_max(1024);56	pub const SS58Prefix: u8 = 42;57}5859impl frame_system::Config for Test {60	type BaseCallFilter = Everything;61	type BlockWeights = ();62	type BlockLength = ();63	type DbWeight = ();64	type Origin = Origin;65	type Call = Call;66	type Index = u64;67	type BlockNumber = u64;68	type Hash = H256;69	type Hashing = BlakeTwo256;70	type AccountId = u64;71	type Lookup = IdentityLookup<Self::AccountId>;72	type Header = Header;73	type Event = ();74	type BlockHashCount = BlockHashCount;75	type Version = ();76	type PalletInfo = PalletInfo;77	type AccountData = pallet_balances::AccountData<u64>;78	type OnNewAccount = ();79	type OnKilledAccount = ();80	type SystemWeightInfo = ();81	type SS58Prefix = SS58Prefix;82	type OnSetCode = ();83}8485parameter_types! {86	pub TreasuryAccountId: u64 = 1234;87	pub const InflationBlockInterval: u32 = 100; // every time per how many blocks inflation is applied88}8990impl pallet_inflation::Config for Test {91	type Currency = Balances;92	type TreasuryAccountId = TreasuryAccountId;93	type InflationBlockInterval = InflationBlockInterval;94}9596pub fn new_test_ext() -> sp_io::TestExternalities {97	frame_system::GenesisConfig::default()98		.build_storage::<Test>()99		.unwrap()100		.into()101}102103#[test]104fn inflation_works() {105	new_test_ext().execute_with(|| {106		// Total issuance = 1_000_000_000107		let initial_issuance: u64 = 1_000_000_000;108		let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);109		assert_eq!(Balances::free_balance(1234), initial_issuance);110111		// BlockInflation should be set after 1st block and112		// first inflation deposit should be equal to BlockInflation113		Inflation::on_initialize(1);114115		// SBP M2 review: Verify expected block inflation for year 1116		assert_eq!(Inflation::block_inflation(), 1901);117		assert_eq!(118			Balances::free_balance(1234) - initial_issuance,119			Inflation::block_inflation()120		);121	});122}123124#[test]125fn inflation_second_deposit() {126	new_test_ext().execute_with(|| {127		// Total issuance = 1_000_000_000128		let initial_issuance: u64 = 1_000_000_000;129		let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);130		assert_eq!(Balances::free_balance(1234), initial_issuance);131		Inflation::on_initialize(1);132133		// Next inflation deposit happens when block is multiple of InflationBlockInterval134		let mut block: u32 = 2;135		let balance_before: u64 = Balances::free_balance(1234);136		while block % InflationBlockInterval::get() != 0 {137			Inflation::on_initialize(block as u64);138			block += 1;139		}140		let balance_just_before: u64 = Balances::free_balance(1234);141		assert_eq!(balance_before, balance_just_before);142143		// The block with inflation144		Inflation::on_initialize(block as u64);145		let balance_after: u64 = Balances::free_balance(1234);146		assert_eq!(147			balance_after - balance_just_before,148			Inflation::block_inflation()149		);150	});151}152153#[test]154fn inflation_in_1_year() {155	new_test_ext().execute_with(|| {156		// Total issuance = 1_000_000_000157		let initial_issuance: u64 = 1_000_000_000;158		let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);159		assert_eq!(Balances::free_balance(1234), initial_issuance);160		Inflation::on_initialize(1);161		let block_inflation_year_0 = Inflation::block_inflation();162163		// SBP M2 review: go through all the block inflations for year 1,164		// total issuance will be updated accordingly165		for block in (100..YEAR).step_by(100) {166			Inflation::on_initialize(block);167		}168		assert_eq!(169			initial_issuance + (1901 * (YEAR / 100)),170			<Balances as Currency<_>>::total_issuance()171		);172173		Inflation::on_initialize(YEAR);174		let block_inflation_year_1 = Inflation::block_inflation();175		// SBP M2 review: Verify expected block inflation for year 2176		assert_eq!(block_inflation_year_1, 1952);177178		// SBP M2 review: this is actually not true179		// Assert that year 1 inflation is less than year 0180		// assert!(block_inflation_year_0 > block_inflation_year_1);181	});182}183184#[test]185fn inflation_in_1_to_9_years() {186	new_test_ext().execute_with(|| {187		// Total issuance = 1_000_000_000188		let initial_issuance: u64 = 1_000_000_000;189		let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);190		assert_eq!(Balances::free_balance(1234), initial_issuance);191		Inflation::on_initialize(1);192193		for year in 1..=9 {194			let block_inflation_year_before = Inflation::block_inflation();195			Inflation::on_initialize(YEAR * year);196			let block_inflation_year_after = Inflation::block_inflation();197198			// SBP M2 review: this is actually not true (not for the first few years)199			// Assert that next year inflation is less than previous year inflation200			assert!(block_inflation_year_before > block_inflation_year_after);201		}202	});203}204205#[test]206fn inflation_after_year_10_is_flat() {207	new_test_ext().execute_with(|| {208		// Total issuance = 1_000_000_000209		let initial_issuance: u64 = 1_000_000_000;210		let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);211		assert_eq!(Balances::free_balance(1234), initial_issuance);212		Inflation::on_initialize(YEAR * 9);213214		for year in 10..=20 {215			let block_inflation_year_before = Inflation::block_inflation();216			Inflation::on_initialize(YEAR * year);217			let block_inflation_year_after = Inflation::block_inflation();218219			// Assert that next year inflation is equal to previous year inflation220			assert_eq!(block_inflation_year_before, block_inflation_year_after);221		}222	});223}224225#[test]226fn inflation_rate_by_year() {227	new_test_ext().execute_with(|| {228		let payouts: u64 = YEAR / InflationBlockInterval::get() as u64;229230		// Inflation starts at 10% and does down by 2/3% every year until year 9 (included),231		// then it is flat.232		let payout_by_year: [u64; 11] = [1000, 933, 867, 800, 733, 667, 600, 533, 467, 400, 400];233234		// For accuracy total issuance = payout0 * payouts * 10;235		let initial_issuance: u64 = payout_by_year[0] * payouts * 10;236		let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);237		assert_eq!(Balances::free_balance(1234), initial_issuance);238239		for year in 0..=10 {240			// Year first block241			Inflation::on_initialize(year * YEAR);242			let mut actual_payout = Inflation::block_inflation();243			assert_eq!(actual_payout, payout_by_year[year as usize]);244245			// Year second block246			Inflation::on_initialize(year * YEAR + 1);247			actual_payout = Inflation::block_inflation();248			assert_eq!(actual_payout, payout_by_year[year as usize]);249250			// Year middle block251			Inflation::on_initialize(year * YEAR + YEAR / 2);252			actual_payout = Inflation::block_inflation();253			assert_eq!(actual_payout, payout_by_year[year as usize]);254255			// Year last block256			Inflation::on_initialize((year + 1) * YEAR - 1);257			actual_payout = Inflation::block_inflation();258			assert_eq!(actual_payout, payout_by_year[year as usize]);259		}260	});261}
modifiedpallets/nft/src/mock.rsdiffbeforeafterboth
--- a/pallets/nft/src/mock.rs
+++ b/pallets/nft/src/mock.rs
@@ -27,6 +27,10 @@
 		System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
 		TemplateModule: pallet_template::{Pallet, Call, Storage},
 		Balances: pallet_balances::{Pallet, Call, Storage},
+		Common: pallet_common::{Pallet, Storage, Event<T>},
+		Fungible: pallet_fungible::{Pallet, Storage},
+		Refungible: pallet_refungible::{Pallet, Storage},
+		Nonfungible: pallet_nonfungible::{Pallet, Storage},
 	}
 );
 
@@ -151,7 +155,6 @@
 		Self::from_sub(0)
 	}
 }
-
 
 pub struct TestEtheremTransactionSender;
 impl pallet_ethereum::EthereumTransactionSender for TestEtheremTransactionSender {
modifiedpallets/nft/src/tests.rsdiffbeforeafterboth
--- a/pallets/nft/src/tests.rs
+++ b/pallets/nft/src/tests.rs
@@ -3,10 +3,9 @@
 use crate::mock::*;
 use crate::{AccessMode, CollectionMode};
 use nft_data_structs::{
-	COLLECTION_NUMBER_LIMIT, Collection, CollectionId, CreateItemData, CreateFungibleData, 
-	CreateNftData, CreateReFungibleData, ExistenceRequirement, MAX_COLLECTION_DESCRIPTION_LENGTH, 
-	MAX_COLLECTION_NAME_LENGTH, MAX_DECIMAL_POINTS, MAX_TOKEN_PREFIX_LENGTH, COLLECTION_ADMINS_LIMIT, 
-	MetaUpdatePermission, Pays, PostDispatchInfo, TokenId, Weight, WithdrawReasons,
+	COLLECTION_NUMBER_LIMIT, CollectionId, CreateItemData, CreateFungibleData, 
+	CreateNftData, CreateReFungibleData, MAX_DECIMAL_POINTS, COLLECTION_ADMINS_LIMIT, 
+	MetaUpdatePermission, TokenId,
 };
 
 use frame_support::{assert_noop, assert_ok};
@@ -213,7 +212,7 @@
 				.collect()
 		));
 		for (index, data) in items_data.into_iter().enumerate() {
-			let item = <pallet_nonfungible::TokenData<Test>>::get((CollectionId(1), TokenId((index + 1) as u32))).unwrap();
+			let item = <pallet_refungible::TokenData<Test>>::get((CollectionId(1), TokenId((index + 1) as u32)));
 			let balance = <pallet_refungible::Balance<Test>>::get((CollectionId(1), TokenId(1), account(1)));
 			assert_eq!(item.const_data.to_vec(), data.const_data.into_inner());
 			assert_eq!(item.variable_data.to_vec(), data.variable_data.into_inner());
@@ -274,7 +273,7 @@
 		assert_eq!(<pallet_fungible::Balance<Test>>::get((CollectionId(1), account(1))), 5);
 
 		// change owner scenario
-		assert_ok!(TemplateModule::transfer(origin1, account(2), CollectionId(1), TokenId(1), 5));
+		assert_ok!(TemplateModule::transfer(origin1, account(2), CollectionId(1), TokenId(0), 5));
 		assert_eq!(<pallet_fungible::Balance<Test>>::get((CollectionId(1), account(1))), 0);
 
 		// split item scenario
@@ -282,12 +281,12 @@
 			origin2.clone(),
 			account(3),
 			CollectionId(1),
-			TokenId(1),
+			TokenId(0),
 			3
 		));
 
 		// split item and new owner has account scenario
-		assert_ok!(TemplateModule::transfer(origin2, account(3), CollectionId(1), TokenId(1), 1));
+		assert_ok!(TemplateModule::transfer(origin2, account(3), CollectionId(1), TokenId(0), 1));
 		assert_eq!(<pallet_fungible::Balance<Test>>::get((CollectionId(1), account(2))), 1);
 		assert_eq!(<pallet_fungible::Balance<Test>>::get((CollectionId(1), account(3))), 4);
 	});
@@ -298,33 +297,27 @@
 	new_test_ext().execute_with(|| {
 		let collection_id = create_test_collection(&CollectionMode::ReFungible, CollectionId(1));
 
+		// Create RFT 1 in 1023 pieces for account 1
 		let data = default_re_fungible_data();
 		create_test_item(collection_id, &data.clone().into());
+		let item = <pallet_refungible::TokenData<Test>>::get((collection_id, TokenId(1)));
+		assert_eq!(item.const_data, data.const_data.into_inner());
+		assert_eq!(item.variable_data, data.variable_data.into_inner());
+		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(1))), 1);
+		assert_eq!(<pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(1))), 1023);
+		assert_eq!(<pallet_refungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))), true);
 
+		// Account 1 transfers all 1023 pieces of RFT 1 to account 2
 		let origin1 = Origin::signed(1);
 		let origin2 = Origin::signed(2);
-		{
-			let item = <pallet_refungible::TokenData<Test>>::get((collection_id, TokenId(1)));
-			let balance = <pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(1)));
-			assert_eq!(item.const_data, data.const_data.into_inner());
-			assert_eq!(item.variable_data, data.variable_data.into_inner());
-			assert_eq!(balance, 1023);
-		}
-		
-		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(1))), 1023);
-		assert_eq!(<pallet_refungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))), true);
-
-		// change owner scenario
 		assert_ok!(TemplateModule::transfer(origin1, account(2), CollectionId(1), TokenId(1), 1023));
-
-		let balance2 = <pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(2)));
-		assert_eq!(balance2, 1023);
+		assert_eq!(<pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(2))), 1023);
 		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(1))), 0);
-		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(2))), 1023);
+		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(2))), 1);
 		assert_eq!(<pallet_refungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))), false);
 		assert_eq!(<pallet_refungible::Owned<Test>>::get((collection_id, account(2), TokenId(1))), true);
 
-		// split item scenario
+		// Account 2 transfers 500 pieces of RFT 1 to account 3
 		assert_ok!(TemplateModule::transfer(
 			origin2.clone(),
 			account(3),
@@ -332,29 +325,19 @@
 			TokenId(1),
 			500
 		));
-		{
-			let item = <pallet_refungible::TokenData<Test>>::get((CollectionId(1), TokenId(1)));
-			let balance2 = <pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(2)));
-			let balance3 = <pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(3)));
-			assert_eq!(balance2, 523);
-			assert_eq!(balance3, 500);
-		}
-		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(2))), 523);
-		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(3))), 500);
+		assert_eq!(<pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(2))), 523);
+		assert_eq!(<pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(3))), 500);
+		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(2))), 1);
+		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(3))), 1);
 		assert_eq!(<pallet_refungible::Owned<Test>>::get((collection_id, account(2), TokenId(1))), true);
 		assert_eq!(<pallet_refungible::Owned<Test>>::get((collection_id, account(3), TokenId(1))), true);
 
-		// split item and new owner has account scenario
+		// Account 2 transfers 200 more pieces of RFT 1 to account 3 with pre-existing balance
 		assert_ok!(TemplateModule::transfer(origin2, account(3), CollectionId(1), TokenId(1), 200));
-		{
-			let item = <pallet_refungible::TokenData<Test>>::get((CollectionId(1), TokenId(1)));
-			let balance2 = <pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(2)));
-			let balance3 = <pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(3)));
-			assert_eq!(balance2, 323);
-			assert_eq!(balance3, 700);
-		}
-		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(2))), 323);
-		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(3))), 700);
+		assert_eq!(<pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(2))), 323);
+		assert_eq!(<pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(3))), 700);
+		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(2))), 1);
+		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(3))), 1);
 		assert_eq!(<pallet_refungible::Owned<Test>>::get((collection_id, account(2), TokenId(1))), true);
 		assert_eq!(<pallet_refungible::Owned<Test>>::get((collection_id, account(3), TokenId(1))), true);
 	});
@@ -373,7 +356,7 @@
 
 		let origin1 = Origin::signed(1);
 		// default scenario
-		assert_ok!(TemplateModule::transfer(origin1, account(2), CollectionId(1), TokenId(1), 1000));
+		assert_ok!(TemplateModule::transfer(origin1, account(2), CollectionId(1), TokenId(1), 1));
 		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))), 0);
 		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(2))), 1);
 		assert_eq!(<pallet_nonfungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))), false);
@@ -382,6 +365,45 @@
 }
 
 #[test]
+fn transfer_nft_item_wrong_value() {
+	new_test_ext().execute_with(|| {
+		let collection_id = create_test_collection(&CollectionMode::NFT, CollectionId(1));
+
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
+		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))), 1);
+		assert_eq!(<pallet_nonfungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))), true);
+
+		let origin1 = Origin::signed(1);
+
+		assert_noop!(
+			TemplateModule::transfer(origin1, account(2), CollectionId(1), TokenId(1), 2).map_err(|e| e.error),
+			<pallet_nonfungible::Error::<Test>>::NonfungibleItemsHaveNoAmount
+		);
+	});
+}
+
+#[test]
+fn transfer_nft_item_zero_value() {
+	new_test_ext().execute_with(|| {
+		let collection_id = create_test_collection(&CollectionMode::NFT, CollectionId(1));
+
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
+		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))), 1);
+		assert_eq!(<pallet_nonfungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))), true);
+
+		let origin1 = Origin::signed(1);
+
+		// Transferring 0 amount works on NFT...
+		assert_ok!(TemplateModule::transfer(origin1, account(2), CollectionId(1), TokenId(1), 0));
+		// ... and results in no transfer
+		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))), 1);
+		assert_eq!(<pallet_nonfungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))), true);
+	});
+}
+
+#[test]
 fn nft_approve_and_transfer_from() {
 	new_test_ext().execute_with(|| {
 		let collection_id = create_test_collection(&CollectionMode::NFT, CollectionId(1));
@@ -395,14 +417,14 @@
 		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))), 1);
 		assert_eq!(<pallet_nonfungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))), true);
 
-		// neg transfer
+		// neg transfer_from
 		assert_noop!(
-			TemplateModule::transfer_from(origin2.clone(), account(1), account(2), CollectionId(1), TokenId(1), 1),
-			CommonError::<Test>::NoPermission
+			TemplateModule::transfer_from(origin2.clone(), account(1), account(2), CollectionId(1), TokenId(1), 1).map_err(|e| e.error),
+			CommonError::<Test>::TokenValueNotEnough
 		);
 
 		// do approve
-		assert_ok!(TemplateModule::approve(origin1, account(2), CollectionId(1), TokenId(1), 5));
+		assert_ok!(TemplateModule::approve(origin1, account(2), CollectionId(1), TokenId(1), 1));
 		assert_eq!(<pallet_nonfungible::Allowance<Test>>::get((CollectionId(1), TokenId(1))).unwrap(), account(2));
 
 		assert_ok!(TemplateModule::transfer_from(
@@ -425,9 +447,9 @@
 		let origin1 = Origin::signed(1);
 		let origin2 = Origin::signed(2);
 
+		// Create NFT 1 for account 1
 		let data = default_nft_data();
 		create_test_item(collection_id, &data.clone().into());
-
 		assert_eq!(
 			&<pallet_nonfungible::TokenData<Test>>::get((collection_id, TokenId(1))).unwrap().const_data,
 			&data.const_data.into_inner()
@@ -435,6 +457,7 @@
 		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))), 1);
 		assert_eq!(<pallet_nonfungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))), true);
 
+		// Allow allow-list users to mint and add accounts 1, 2, and 3 to allow-list
 		assert_ok!(TemplateModule::set_mint_permission(
 			origin1.clone(),
 			CollectionId(1),
@@ -461,18 +484,17 @@
 			account(3)
 		));
 
-		// do approve
+		// Account 1 approves account 2 for NFT 1 
 		assert_ok!(TemplateModule::approve(
 			origin1.clone(),
 			account(2),
 			CollectionId(1),
 			TokenId(1),
-			5
+			1
 		));
 		assert_eq!(<pallet_nonfungible::Allowance<Test>>::get((CollectionId(1), TokenId(1))).unwrap(), account(2));
-		assert_ok!(TemplateModule::approve(origin1, account(3), CollectionId(1), TokenId(1), 5));
-		assert_eq!(<pallet_nonfungible::Allowance<Test>>::get((CollectionId(1), TokenId(1))).unwrap(), account(3));
 
+		// Account 2 transfers NFT 1 from account 1 to account 3
 		assert_ok!(TemplateModule::transfer_from(
 			origin2,
 			account(1),
@@ -493,12 +515,15 @@
 		let origin1 = Origin::signed(1);
 		let origin2 = Origin::signed(2);
 
+		// Create RFT 1 in 1023 pieces for account 1
 		let data = default_re_fungible_data();
 		create_test_item(collection_id, &data.into());
 
-		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(1))), 1023);
+		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(1))), 1);
+		assert_eq!(<pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(1))), 1023);
 		assert_eq!(<pallet_refungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))), true);
 
+		// Allow public minting, enable allow-list and add accounts 1, 2, 3 to allow-list
 		assert_ok!(TemplateModule::set_mint_permission(
 			origin1.clone(),
 			CollectionId(1),
@@ -525,10 +550,11 @@
 			account(3)
 		));
 
-		// do approve
+		// Account 1 approves account 2 for 1023 pieces of RFT 1
 		assert_ok!(TemplateModule::approve(origin1, account(2), CollectionId(1), TokenId(1), 1023));
 		assert_eq!(<pallet_refungible::Allowance<Test>>::get((CollectionId(1), TokenId(1), account(1), account(2))), 1023);
 
+		// Account 2 transfers 100 pieces of RFT 1 from account 1 to account 3
 		assert_ok!(TemplateModule::transfer_from(
 			origin2,
 			account(1),
@@ -537,10 +563,12 @@
 			TokenId(1),
 			100
 		));
-		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(1))), 923);
-		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(3))), 100);
+		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(1))), 1);
+		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(3))), 1);
+		assert_eq!(<pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(1))), 923);
+		assert_eq!(<pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(3))), 100);
+		assert_eq!(<pallet_refungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))), true);
 		assert_eq!(<pallet_refungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))), true);
-		assert_eq!(<pallet_refungible::Owned<Test>>::get((collection_id, account(1), TokenId(3))), true);
 		assert_eq!(<pallet_refungible::Allowance<Test>>::get((CollectionId(1), TokenId(1), account(1), account(2))), 923);
 	});
 }
@@ -587,11 +615,11 @@
 			origin1.clone(),
 			account(2),
 			CollectionId(1),
-			TokenId(1),
+			TokenId(0),
 			5
 		));
 		assert_eq!(<pallet_fungible::Allowance<Test>>::get((CollectionId(1), account(1), account(2))), 5);
-		assert_ok!(TemplateModule::approve(origin1, account(3), CollectionId(1), TokenId(1), 5));
+		assert_ok!(TemplateModule::approve(origin1, account(3), CollectionId(1), TokenId(0), 5));
 		assert_eq!(<pallet_fungible::Allowance<Test>>::get((CollectionId(1), account(1), account(2))), 5);
 		assert_eq!(<pallet_fungible::Allowance<Test>>::get((CollectionId(1), account(1), account(3))), 5);
 
@@ -600,15 +628,15 @@
 			account(1),
 			account(3),
 			CollectionId(1),
-			TokenId(1),
+			TokenId(0),
 			4
 		));
 
 		assert_eq!(<pallet_fungible::Allowance<Test>>::get((CollectionId(1), account(1), account(2))), 1);
 
 		assert_noop!(
-			TemplateModule::transfer_from(origin2, account(1), account(3), CollectionId(1), TokenId(1), 4),
-			CommonError::<Test>::NoPermission
+			TemplateModule::transfer_from(origin2, account(1), account(3), CollectionId(1), TokenId(0), 4).map_err(|e| e.error),
+			CommonError::<Test>::TokenValueNotEnough
 		);
 	});
 }
@@ -647,17 +675,36 @@
 		let collection_id = create_test_collection(&CollectionMode::NFT, CollectionId(1));
 
 		let origin1 = Origin::signed(1);
-		assert_ok!(TemplateModule::add_collection_admin(
+
+		let data = default_nft_data();
+		create_test_item(collection_id, &data.into());
+
+		// check balance (collection with id = 1, user id = 1)
+		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))), 1);
+
+		// burn item
+		assert_ok!(TemplateModule::burn_item(
 			origin1.clone(),
 			collection_id,
-			account(2)
+			TokenId(1),
+			1
 		));
+		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))), 0);
+	});
+}
+
+#[test]
+fn burn_same_nft_item_twice() {
+	new_test_ext().execute_with(|| {
+		let collection_id = create_test_collection(&CollectionMode::NFT, CollectionId(1));
+
+		let origin1 = Origin::signed(1);
 
 		let data = default_nft_data();
 		create_test_item(collection_id, &data.into());
 
 		// check balance (collection with id = 1, user id = 1)
-		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(1))), 1);
+		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))), 1);
 
 		// burn item
 		assert_ok!(TemplateModule::burn_item(
@@ -666,12 +713,14 @@
 			TokenId(1),
 			1
 		));
+		
+		// burn item again
 		assert_noop!(
-			TemplateModule::burn_item(origin1, collection_id, TokenId(1), 1),
+			TemplateModule::burn_item(origin1, collection_id, TokenId(1), 1).map_err(|e| e.error),
 			CommonError::<Test>::TokenNotFound
 		);
 
-		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(1))), 0);
+		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))), 0);
 	});
 }
 
@@ -694,10 +743,10 @@
 		assert_eq!(<pallet_fungible::Balance<Test>>::get((collection_id, account(1))), 5);
 
 		// burn item
-		assert_ok!(TemplateModule::burn_item(origin1.clone(), CollectionId(1), TokenId(1), 5));
+		assert_ok!(TemplateModule::burn_item(origin1.clone(), CollectionId(1), TokenId(0), 5));
 		assert_noop!(
-			TemplateModule::burn_item(origin1, CollectionId(1), TokenId(1), 5),
-			CommonError::<Test>::TokenValueNotEnough
+			TemplateModule::burn_item(origin1, CollectionId(1), TokenId(0), 5).map_err(|e| e.error),
+			CommonError::<Test>::TokenValueTooLow
 		);
 
 		assert_eq!(<pallet_fungible::Balance<Test>>::get((collection_id, account(1))), 0);
@@ -705,6 +754,31 @@
 }
 
 #[test]
+fn burn_fungible_item_with_token_id() {
+	new_test_ext().execute_with(|| {
+		let collection_id = create_test_collection(&CollectionMode::Fungible(3), CollectionId(1));
+
+		let origin1 = Origin::signed(1);
+		assert_ok!(TemplateModule::add_collection_admin(
+			origin1.clone(),
+			collection_id,
+			account(2)
+		));
+
+		let data = default_fungible_data();
+		create_test_item(collection_id, &data.into());
+
+		// check balance (collection with id = 1, user id = 1)
+		assert_eq!(<pallet_fungible::Balance<Test>>::get((collection_id, account(1))), 5);
+
+		// Try to burn item using Token ID
+		assert_noop!(
+			TemplateModule::burn_item(origin1, CollectionId(1), TokenId(1), 5).map_err(|e| e.error),
+			<pallet_fungible::Error::<Test>>::FungibleItemsHaveNoId
+		);
+	});
+}
+#[test]
 fn burn_refungible_item() {
 	new_test_ext().execute_with(|| {
 		let collection_id = create_test_collection(&CollectionMode::ReFungible, CollectionId(1));
@@ -736,14 +810,14 @@
 		create_test_item(collection_id, &data.into());
 
 		// check balance (collection with id = 1, user id = 2)
-		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(1))), 1023);
+		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((collection_id, account(1))), 1);
 		assert_eq!(<pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(1))), 1023);
 
 		// burn item
 		assert_ok!(TemplateModule::burn_item(origin1.clone(), collection_id, TokenId(1), 1023));
 		assert_noop!(
-			TemplateModule::burn_item(origin1, collection_id, TokenId(1), 1023),
-			CommonError::<Test>::TokenNotFound
+			TemplateModule::burn_item(origin1, collection_id, TokenId(1), 1023).map_err(|e| e.error),
+			CommonError::<Test>::TokenValueTooLow
 		);
 
 		assert_eq!(<pallet_refungible::Balance<Test>>::get((collection_id, TokenId(1), account(1))), 0);
@@ -754,12 +828,9 @@
 fn add_collection_admin() {
 	new_test_ext().execute_with(|| {
 		let collection1_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, CollectionId(1));
-		create_test_collection_for_owner(&CollectionMode::NFT, 2, CollectionId(2));
-		create_test_collection_for_owner(&CollectionMode::NFT, 3, CollectionId(3));
-
 		let origin1 = Origin::signed(1);
 
-		// collection admin
+		// Add collection admins
 		assert_ok!(TemplateModule::add_collection_admin(
 			origin1.clone(),
 			collection1_id,
@@ -771,7 +842,8 @@
 			account(3)
 		));
 
-		assert!(<pallet_common::IsAdmin<Test>>::get((CollectionId(1), account(1))));
+		// Owner is not an admin by default
+		assert_eq!(<pallet_common::IsAdmin<Test>>::get((CollectionId(1), account(1))), false);
 		assert!(<pallet_common::IsAdmin<Test>>::get((CollectionId(1), account(2))));
 		assert!(<pallet_common::IsAdmin<Test>>::get((CollectionId(1), account(3))));
 	});
@@ -781,13 +853,10 @@
 fn remove_collection_admin() {
 	new_test_ext().execute_with(|| {
 		let collection1_id = create_test_collection_for_owner(&CollectionMode::NFT, 1, CollectionId(1));
-		create_test_collection_for_owner(&CollectionMode::NFT, 2, CollectionId(2));
-		create_test_collection_for_owner(&CollectionMode::NFT, 3, CollectionId(3));
-
 		let origin1 = Origin::signed(1);
 		let origin2 = Origin::signed(2);
 
-		// collection admin
+		// Add collection admins 2 and 3
 		assert_ok!(TemplateModule::add_collection_admin(
 			origin1.clone(),
 			collection1_id,
@@ -802,14 +871,16 @@
 		assert!(<pallet_common::IsAdmin<Test>>::get((CollectionId(1), account(2))));
 		assert!(<pallet_common::IsAdmin<Test>>::get((CollectionId(1), account(3))));
 
-		// remove admin
+		// remove admin 3
 		assert_ok!(TemplateModule::remove_collection_admin(
 			origin2,
 			CollectionId(1),
 			account(3)
 		));
-		assert!(<pallet_common::IsAdmin<Test>>::get((CollectionId(1), account(3))));
-		assert_eq!(<pallet_common::IsAdmin<Test>>::get((CollectionId(1), account(2))), false);
+
+		// 2 is still admin, 3 is not an admin anymore
+		assert!(<pallet_common::IsAdmin<Test>>::get((CollectionId(1), account(2))));
+		assert_eq!(<pallet_common::IsAdmin<Test>>::get((CollectionId(1), account(3))), false);
 	});
 }
 
@@ -837,10 +908,10 @@
 		// check balance (collection with id = 1, user id = 1)
 		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((nft_collection_id, account(1))), 1);
 		assert_eq!(<pallet_fungible::Balance<Test>>::get((fungible_collection_id, account(1))), 5);
-		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((re_fungible_collection_id, account(1))), 1023);
+		assert_eq!(<pallet_refungible::AccountBalance<Test>>::get((re_fungible_collection_id, account(1))), 1);
 
 		assert_eq!(<pallet_nonfungible::Owned<Test>>::get((nft_collection_id, account(1), TokenId(1))), true);
-		assert_eq!(<pallet_refungible::Owned<Test>>::get((nft_collection_id, account(1), TokenId(1))), true);
+		assert_eq!(<pallet_refungible::Owned<Test>>::get((re_fungible_collection_id, account(1), TokenId(1))), true);
 	});
 }
 
@@ -1037,7 +1108,7 @@
 			collection_id,
 			account(2)
 		));
-		assert!(<pallet_common::Allowlist<Test>>::get((collection_id, account(2))));
+		assert_eq!(<pallet_common::Allowlist<Test>>::get((collection_id, account(2))), false);
 	});
 }
 
@@ -1048,23 +1119,27 @@
 		let origin1 = Origin::signed(1);
 		let origin2 = Origin::signed(2);
 
+		// Owner adds admin
 		assert_ok!(TemplateModule::add_collection_admin(
 			origin1.clone(),
 			collection_id,
 			account(2)
 		));
 
+		// Owner adds address 3 to allow list
 		assert_ok!(TemplateModule::add_to_allow_list(
 			origin1,
 			collection_id,
 			account(3)
 		));
+
+		// Admin removes address 3 from allow list
 		assert_ok!(TemplateModule::remove_from_allow_list(
 			origin2,
 			collection_id,
 			account(3)
 		));
-		assert!(<pallet_common::Allowlist<Test>>::get((collection_id, account(3))));
+		assert_eq!(<pallet_common::Allowlist<Test>>::get((collection_id, account(3))), false);
 	});
 }
 
@@ -1107,17 +1182,27 @@
 		let origin1 = Origin::signed(1);
 		let origin2 = Origin::signed(2);
 
+		// Add account 2 to allow list
 		assert_ok!(TemplateModule::add_to_allow_list(
 			origin1.clone(),
 			collection_id,
 			account(2)
 		));
+
+		// Account 2 is in collection allow-list
+		assert!(<pallet_common::Allowlist<Test>>::get((collection_id, account(2))));
+
+		// Destroy collection
 		assert_ok!(TemplateModule::destroy_collection(origin1, collection_id));
+
+		// Attempt to remove account 2 from collection allow-list => error
 		assert_noop!(
 			TemplateModule::remove_from_allow_list(origin2, collection_id, account(2)),
 			CommonError::<Test>::CollectionNotFound
 		);
-		assert!(<pallet_common::Allowlist<Test>>::get((collection_id, account(2))));
+
+		// Account 2 is not found in collection allow-list anyway
+		assert_eq!(<pallet_common::Allowlist<Test>>::get((collection_id, account(2))), false);
 	});
 }
 
@@ -1138,12 +1223,13 @@
 			collection_id,
 			account(2)
 		));
+		assert_eq!(<pallet_common::Allowlist<Test>>::get((collection_id, account(2))), false);
 		assert_ok!(TemplateModule::remove_from_allow_list(
 			origin1,
 			collection_id,
 			account(2)
 		));
-		assert!(<pallet_common::Allowlist<Test>>::get((collection_id, account(2))));
+		assert_eq!(<pallet_common::Allowlist<Test>>::get((collection_id, account(2))), false);
 	});
 }
 
@@ -1170,7 +1256,7 @@
 		));
 
 		assert_noop!(
-			TemplateModule::transfer(origin1, account(3), CollectionId(1), TokenId(1), 1),
+			TemplateModule::transfer(origin1, account(3), CollectionId(1), TokenId(1), 1).map_err(|e| e.error),
 			CommonError::<Test>::AddressNotInAllowlist
 		);
 	});
@@ -1218,7 +1304,7 @@
 		));
 
 		assert_noop!(
-			TemplateModule::transfer_from(origin1, account(1), account(3), CollectionId(1), TokenId(1), 1),
+			TemplateModule::transfer_from(origin1, account(1), account(3), CollectionId(1), TokenId(1), 1).map_err(|e| e.error),
 			CommonError::<Test>::AddressNotInAllowlist
 		);
 	});
@@ -1247,7 +1333,7 @@
 		));
 
 		assert_noop!(
-			TemplateModule::transfer(origin1, account(3), collection_id, TokenId(1), 1),
+			TemplateModule::transfer(origin1, account(3), collection_id, TokenId(1), 1).map_err(|e| e.error),
 			CommonError::<Test>::AddressNotInAllowlist
 		);
 	});
@@ -1296,7 +1382,7 @@
 		));
 
 		assert_noop!(
-			TemplateModule::transfer_from(origin1, account(1), account(3), collection_id, TokenId(1), 1),
+			TemplateModule::transfer_from(origin1, account(1), account(3), collection_id, TokenId(1), 1).map_err(|e| e.error),
 			CommonError::<Test>::AddressNotInAllowlist
 		);
 	});
@@ -1319,7 +1405,7 @@
 			AccessMode::AllowList
 		));
 		assert_noop!(
-			TemplateModule::burn_item(origin1.clone(), CollectionId(1), TokenId(1), 5),
+			TemplateModule::burn_item(origin1.clone(), CollectionId(1), TokenId(1), 1).map_err(|e| e.error),
 			CommonError::<Test>::AddressNotInAllowlist
 		);
 	});
@@ -1344,7 +1430,7 @@
 
 		// do approve
 		assert_noop!(
-			TemplateModule::approve(origin1, account(1), CollectionId(1), TokenId(1), 5),
+			TemplateModule::approve(origin1, account(1), CollectionId(1), TokenId(1), 1).map_err(|e| e.error),
 			CommonError::<Test>::AddressNotInAllowlist
 		);
 	});
@@ -1387,11 +1473,13 @@
 	new_test_ext().execute_with(|| {
 		let collection_id = create_test_collection(&CollectionMode::NFT, CollectionId(1));
 
+		// Create NFT for account 1
 		let data = default_nft_data();
 		create_test_item(collection_id, &data.into());
 
 		let origin1 = Origin::signed(1);
 
+		// Toggle Allow List mode and add accounts 1 and 2
 		assert_ok!(TemplateModule::set_public_access_mode(
 			origin1.clone(),
 			collection_id,
@@ -1408,16 +1496,17 @@
 			account(2)
 		));
 
-		// do approve
+		// Sself-approve account 1 for NFT 1
 		assert_ok!(TemplateModule::approve(
 			origin1.clone(),
 			account(1),
 			CollectionId(1), 
 			TokenId(1),
-			5
+			1
 		));
 		assert_eq!(<pallet_nonfungible::Allowance<Test>>::get((CollectionId(1), TokenId(1))).unwrap(), account(1));
 
+		// Transfer from 1 to 2
 		assert_ok!(TemplateModule::transfer_from(
 			origin1,
 			account(1),
@@ -1513,7 +1602,7 @@
 		));
 
 		assert_noop!(
-			TemplateModule::create_item(origin2, CollectionId(1), account(2), default_nft_data().into()),
+			TemplateModule::create_item(origin2, CollectionId(1), account(2), default_nft_data().into()).map_err(|e| e.error),
 			CommonError::<Test>::PublicMintingNotAllowed
 		);
 	});
@@ -1540,7 +1629,7 @@
 		));
 
 		assert_noop!(
-			TemplateModule::create_item(origin2, CollectionId(1), account(2), default_nft_data().into()),
+			TemplateModule::create_item(origin2, CollectionId(1), account(2), default_nft_data().into()).map_err(|e| e.error),
 			CommonError::<Test>::PublicMintingNotAllowed
 		);
 	});
@@ -1626,7 +1715,7 @@
 		));
 
 		assert_noop!(
-			TemplateModule::create_item(origin2, collection_id, account(2), default_nft_data().into()),
+			TemplateModule::create_item(origin2, collection_id, account(2), default_nft_data().into()).map_err(|e| e.error),
 			CommonError::<Test>::AddressNotInAllowlist
 		);
 	});
@@ -1674,14 +1763,23 @@
 	});
 }
 
-// Total number of collections. Negotive test
 #[test]
+fn create_max_collections() {
+	new_test_ext().execute_with(|| {
+		for i in 1..=COLLECTION_NUMBER_LIMIT {
+			create_test_collection(&CollectionMode::NFT, CollectionId(i));
+		}
+	});
+}
+
+// Total number of collections. Negative test
+#[test]
 fn total_number_collections_bound_neg() {
 	new_test_ext().execute_with(|| {
 		let origin1 = Origin::signed(1);
 
-		for i in 0..COLLECTION_NUMBER_LIMIT {
-			create_test_collection(&CollectionMode::NFT, CollectionId(i + 1));
+		for i in 1..=COLLECTION_NUMBER_LIMIT {
+			create_test_collection(&CollectionMode::NFT, CollectionId(i));
 		}
 
 		let col_name1: Vec<u16> = "Test1\0".encode_utf16().collect::<Vec<u16>>();
@@ -1722,14 +1820,14 @@
 
 		let origin1 = Origin::signed(1);
 
-		for _ in 0..MAX_TOKEN_OWNERSHIP {
+		for _ in 1..=MAX_TOKEN_OWNERSHIP {
 			let data = default_nft_data();
 			create_test_item(collection_id, &data.clone().into());
 		}
 
 		let data = default_nft_data();
 		assert_noop!(
-			TemplateModule::create_item(origin1, CollectionId(1), account(1), data.into()),
+			TemplateModule::create_item(origin1, CollectionId(1), account(1), data.into()).map_err(|e| e.error),
 			CommonError::<Test>::AccountTokenLimitExceeded
 		);
 	});
@@ -1902,13 +2000,31 @@
 
 		let variable_data = b"test data".to_vec();
 		assert_noop!(
-			TemplateModule::set_variable_meta_data(origin1, collection_id, TokenId(1), variable_data),
+			TemplateModule::set_variable_meta_data(origin1, collection_id, TokenId(0), variable_data).map_err(|e| e.error),
 			<pallet_fungible::Error<Test>>::FungibleItemsDontHaveData
 		);
 	});
 }
 
 #[test]
+fn set_variable_meta_data_on_fungible_token_with_token_id_fails() {
+	new_test_ext().execute_with(|| {
+		let collection_id = create_test_collection(&CollectionMode::Fungible(3), CollectionId(1));
+
+		let origin1 = Origin::signed(1);
+
+		let data = default_fungible_data();
+		create_test_item(collection_id, &data.into());
+
+		let variable_data = b"test data".to_vec();
+		assert_noop!(
+			TemplateModule::set_variable_meta_data(origin1, collection_id, TokenId(1), variable_data).map_err(|e| e.error),
+			<pallet_fungible::Error::<Test>>::FungibleItemsHaveNoId
+		);
+	});
+}
+
+#[test]
 fn set_variable_meta_data_on_nft_token_fails_for_big_data() {
 	new_test_ext().execute_with(|| {
 		let collection_id = create_test_collection(&CollectionMode::NFT, CollectionId(1));
@@ -1920,7 +2036,7 @@
 
 		let variable_data = b"test set_variable_meta_data method, bigger than limits.".to_vec();
 		assert_noop!(
-			TemplateModule::set_variable_meta_data(origin1, collection_id, TokenId(1), variable_data),
+			TemplateModule::set_variable_meta_data(origin1, collection_id, TokenId(1), variable_data).map_err(|e| e.error),
 			CommonError::<Test>::TokenVariableDataLimitExceeded
 		);
 	});
@@ -1938,7 +2054,7 @@
 
 		let variable_data = b"test set_variable_meta_data method, bigger than limits.".to_vec();
 		assert_noop!(
-			TemplateModule::set_variable_meta_data(origin1, collection_id, TokenId(1), variable_data),
+			TemplateModule::set_variable_meta_data(origin1, collection_id, TokenId(1), variable_data).map_err(|e| e.error),
 			CommonError::<Test>::TokenVariableDataLimitExceeded
 		);
 	});
@@ -2013,7 +2129,7 @@
 				collection_id,
 				TokenId(1),
 				variable_data.clone()
-			),
+			).map_err(|e| e.error),
 			CommonError::<Test>::TokenVariableDataLimitExceeded
 		);
 	})
@@ -2035,7 +2151,7 @@
 		let origin1 = Origin::signed(1);
 
 		// default scenario
-		assert_ok!(TemplateModule::transfer(origin1, account(2), collection_id, TokenId(1), 1000));
+		assert_ok!(TemplateModule::transfer(origin1, account(2), collection_id, TokenId(1), 1));
 		assert_eq!(<pallet_nonfungible::Owned<Test>>::get((collection_id, account(1), TokenId(1))), false);
 		assert_eq!(<pallet_nonfungible::Owned<Test>>::get((collection_id, account(2), TokenId(1))), true);
 		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))), 0);
@@ -2133,7 +2249,7 @@
 				collection_id,
 				TokenId(1),
 				variable_data.clone()
-			),
+			).map_err(|e| e.error),
 			CommonError::<Test>::NoPermission
 		);
 	});
@@ -2188,7 +2304,7 @@
 				collection_id,
 				TokenId(1),
 				variable_data.clone()
-			),
+			).map_err(|e| e.error),
 			CommonError::<Test>::NoPermission
 		);
 	});
@@ -2213,7 +2329,7 @@
 
 		// default scenario
 		assert_noop!(
-			TemplateModule::transfer(origin1, account(2), CollectionId(1), TokenId(1), 1000),
+			TemplateModule::transfer(origin1, account(2), CollectionId(1), TokenId(1), 1).map_err(|e| e.error),
 			CommonError::<Test>::TransferNotAllowed
 		);
 		assert_eq!(<pallet_nonfungible::AccountBalance<Test>>::get((collection_id, account(1))), 1);
modifiedpallets/scheduler/src/lib.rsdiffbeforeafterboth
--- a/pallets/scheduler/src/lib.rs
+++ b/pallets/scheduler/src/lib.rs
@@ -795,8 +795,8 @@
 	use super::*;
 
 	use frame_support::{
-		Hashable, assert_err, assert_noop, assert_ok, ord_parameter_types, parameter_types,
-		traits::{Contains, OnFinalize, OnInitialize},
+		ord_parameter_types, parameter_types,
+		traits::Contains,
 		weights::constants::RocksDbWeight,
 	};
 	use sp_core::H256;
@@ -806,7 +806,6 @@
 		traits::{BlakeTwo256, IdentityLookup},
 	};
 	use frame_system::{EnsureOneOf, EnsureRoot, EnsureSignedBy};
-	use substrate_test_utils::assert_eq_uvec;
 	use crate as scheduler;
 
 	mod logger {
@@ -815,9 +814,6 @@
 
 		thread_local! {
 			static LOG: RefCell<Vec<(OriginCaller, u32)>> = RefCell::new(Vec::new());
-		}
-		pub fn log() -> Vec<(OriginCaller, u32)> {
-			LOG.with(|log| log.borrow().clone())
 		}
 		pub trait Config: system::Config {
 			type Event: From<Event> + Into<<Self as system::Config>::Event>;
@@ -928,24 +924,5 @@
 		type MaxScheduledPerBlock = MaxScheduledPerBlock;
 		type WeightInfo = ();
 		type SponsorshipHandler = ();
-	}
-
-	pub fn new_test_ext() -> sp_io::TestExternalities {
-		let t = system::GenesisConfig::default()
-			.build_storage::<Test>()
-			.unwrap();
-		t.into()
-	}
-
-	fn run_to_block(n: u64) {
-		while System::block_number() < n {
-			Scheduler::on_finalize(System::block_number());
-			System::set_block_number(System::block_number() + 1);
-			Scheduler::on_initialize(System::block_number());
-		}
-	}
-
-	fn root() -> OriginCaller {
-		system::RawOrigin::Root.into()
 	}
 }
modifiedprimitives/nft/src/lib.rsdiffbeforeafterboth
--- a/primitives/nft/src/lib.rs
+++ b/primitives/nft/src/lib.rs
@@ -29,10 +29,14 @@
 pub const MAX_DECIMAL_POINTS: DecimalPoints = 30;
 pub const MAX_REFUNGIBLE_PIECES: u128 = 1_000_000_000_000_000_000_000;
 pub const MAX_SPONSOR_TIMEOUT: u32 = 10_368_000;
-pub const MAX_TOKEN_OWNERSHIP: u32 = 10_000_000;
 
+pub const MAX_TOKEN_OWNERSHIP: u32 = if cfg!(not(feature = "limit-testing")) {
+	10_000_000
+} else {
+	10
+};
 pub const COLLECTION_NUMBER_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {
-	100000
+	100_000
 } else {
 	10
 };
@@ -44,7 +48,7 @@
 pub const COLLECTION_ADMINS_LIMIT: u32 = 5;
 pub const COLLECTION_TOKEN_LIMIT: u32 = u32::MAX;
 pub const ACCOUNT_TOKEN_OWNERSHIP_LIMIT: u32 = if cfg!(not(feature = "limit-testing")) {
-	1000000
+	1_000_000
 } else {
 	10
 };