--- a/runtime/tests/src/tests.rs +++ b/runtime/tests/src/tests.rs @@ -626,6 +626,41 @@ } #[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!( + >::get((collection_id, account(1))), + 1 + ); + assert_eq!( + >::get((collection_id, account(1), TokenId(1))), + true + ); + + let origin1 = RuntimeOrigin::signed(1); + + // Transferring 0 amount works on NFT... + assert_noop!( + Unique::transfer(origin1, account(2), CollectionId(1), TokenId(1), 0), + >::ZeroTransferNotAllowed + ); + // ... and results in no transfer + assert_eq!( + >::get((collection_id, account(1))), + 1 + ); + assert_eq!( + >::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));