difftreelog
Fix test. Change source of pieces info.
in: master
2 files changed
pallets/refungible/src/lib.rsdiffbeforeafterboth712 }712 }713713714 fn total_pieces(collection_id: CollectionId, token_id: TokenId) -> u128 {714 fn total_pieces(collection_id: CollectionId, token_id: TokenId) -> u128 {715 // Not "try_fold" because total count of pieces is limited by 'MAX_REFUNGIBLE_PIECES'.716 <Balance<T>>::iter_prefix((collection_id, token_id)).fold(0, |total, piece| total + piece.1)715 <TotalSupply<T>>::get((collection_id, token_id))717 }716 }718}717}719718tests/src/refungible.test.tsdiffbeforeafterboth68 });68 });69 });69 });7071 it.only('Check total pieces of token', async () => {72 await usingApi(async api => {73 const createCollectionResult = await createCollection(api, alice, {mode: {type: 'ReFungible'}});74 expect(createCollectionResult.success).to.be.true; 75 const collectionId = createCollectionResult.collectionId;76 const amountPieces = 100n;77 const result = await createRefungibleToken(api, alice, collectionId, amountPieces);78 expect(result.success).to.be.true;79 {80 const totalPieces = await api.rpc.unique.totalPieces(collectionId, result.itemId);81 expect(totalPieces.toBigInt()).to.be.eq(amountPieces);82 }8384 await transfer(api, collectionId, result.itemId, alice, bob, 60n);85 {86 const totalPieces = await api.rpc.unique.totalPieces(collectionId, result.itemId);87 expect(totalPieces.toBigInt()).to.be.eq(amountPieces);88 }89 });90 });709171 it('Transfer token pieces', async () => {92 it('Transfer token pieces', async () => {72 await usingApi(async api => {93 await usingApi(async api => {