From aacbd92981b04f5c6522fce28e3e2fd555afd283 Mon Sep 17 00:00:00 2001 From: Daniel Shiposha Date: Tue, 06 Dec 2022 14:50:51 +0000 Subject: [PATCH] fix: restore transfer_nft_item_zero_value --- --- a/runtime/tests/src/tests.rs +++ b/runtime/tests/src/tests.rs @@ -626,6 +626,44 @@ } #[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_ok!(Unique::transfer( + origin1, + account(2), + CollectionId(1), + TokenId(1), + 0 + )); + // ... 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)); -- gitstuff