From 414acfa2cc1033d8a9df618cc8289b22f973421c Mon Sep 17 00:00:00 2001 From: Szegoo Date: Thu, 8 Aug 2024 08:17:15 +0200 Subject: [PATCH] add tests --- pallets/regions/src/lib.rs | 4 ---- pallets/regions/src/tests.rs | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pallets/regions/src/lib.rs b/pallets/regions/src/lib.rs index c44200ea..8f6a3406 100644 --- a/pallets/regions/src/lib.rs +++ b/pallets/regions/src/lib.rs @@ -129,25 +129,21 @@ pub mod pallet { /// The ismp get request commitment. request_commitment: H256, }, - /// A region was minted via a cross chain transfer. RegionMinted { /// minted region id region_id: RegionId, }, - /// A region was burnt. RegionBurnt { /// burnt region id region_id: RegionId, }, - /// A region was locked. RegionLocked { /// locked region id region_id: RegionId, }, - /// A region was unlocked. RegionUnlocked { /// unlocked region id diff --git a/pallets/regions/src/tests.rs b/pallets/regions/src/tests.rs index 0d5da3db..d4d460e1 100644 --- a/pallets/regions/src/tests.rs +++ b/pallets/regions/src/tests.rs @@ -41,6 +41,7 @@ fn nonfungibles_implementation_works() { assert!(Regions::regions(®ion_id).is_none()); assert_ok!(Regions::mint_into(®ion_id.into(), &2)); + System::assert_last_event(Event::RegionMinted { region_id }.into()); assert_eq!( Regions::regions(®ion_id).unwrap(), Region { owner: 2, locked: false, record: Record::Unavailable } @@ -55,6 +56,7 @@ fn nonfungibles_implementation_works() { assert_noop!(Regions::burn(®ion_id.into(), Some(&1)), Error::::NotOwner); assert_ok!(Regions::burn(®ion_id.into(), Some(&2))); + System::assert_last_event(Event::RegionBurnt { region_id }.into()); assert!(Regions::regions(®ion_id).is_none()); assert_noop!(Regions::burn(®ion_id.into(), None), Error::::UnknownRegion); @@ -427,6 +429,7 @@ fn region_locking_works() { assert_noop!(Regions::lock(®ion_id.into(), Some(2)), Error::::NotOwner); assert_ok!(Regions::lock(®ion_id.into(), Some(1))); + System::assert_last_event(Event::RegionLocked { region_id }.into()); assert_eq!( Regions::regions(®ion_id).unwrap(), Region { owner: 1, locked: true, record: Record::Unavailable } @@ -461,6 +464,7 @@ fn region_unlocking_works() { assert_noop!(Regions::unlock(®ion_id.into(), Some(1)), Error::::RegionNotLocked); assert_ok!(Regions::lock(®ion_id.into(), Some(1))); + System::assert_last_event(Event::RegionLocked { region_id }.into()); assert_eq!( Regions::regions(®ion_id).unwrap(), Region { owner: 1, locked: true, record: Record::Unavailable } @@ -470,6 +474,7 @@ fn region_unlocking_works() { assert_noop!(Regions::unlock(®ion_id.into(), Some(2)), Error::::NotOwner); assert_ok!(Regions::unlock(®ion_id.into(), Some(1))); + System::assert_last_event(Event::RegionUnlocked { region_id }.into()); assert_eq!( Regions::regions(®ion_id).unwrap(), Region { owner: 1, locked: false, record: Record::Unavailable }