difftreelog
Fix tests: Zero transfer allowed (EIP-20)
in: master
3 files changed
tests/src/eth/fungible.test.tsdiffbeforeafterboth292 // 1. Cannot transfer more than have292 // 1. Cannot transfer more than have293 const receiver = testCase === 'transfer' ? receiverEth : receiverCrossEth;293 const receiver = testCase === 'transfer' ? receiverEth : receiverCrossEth;294 await expect(collectionEvm.methods[testCase](receiver, BALANCE_TO_TRANSFER).send({from: sender})).to.be.rejected;294 await expect(collectionEvm.methods[testCase](receiver, BALANCE_TO_TRANSFER).send({from: sender})).to.be.rejected;295 // 2. Zero transfer not allowed295 // 2. Zero transfer allowed (EIP-20):296 await expect(collectionEvm.methods[testCase](receiver, 0n).send({from: sender})).to.be.rejected;296 await collectionEvm.methods[testCase](receiver, 0n).send({from: sender});297 }));297 }));298 298 299 299 tests/src/fungible.test.tsdiffbeforeafterboth167 await collection.mint(alice, 10n, {Substrate: bob.address});167 await collection.mint(alice, 10n, {Substrate: bob.address});168168169 // 1. Alice cannot transfer Bob's token:169 // 1. Alice cannot transfer Bob's token:170 await expect(collection.transfer(alice, {Substrate: charlie.address}, 0n)).to.be.rejectedWith('common.ZeroTransferNotAllowed');170 await expect(collection.transfer(alice, {Substrate: charlie.address}, 0n)).to.be.rejectedWith('common.TokenValueTooLow');171 await expect(collection.transfer(alice, {Substrate: charlie.address}, 1n)).to.be.rejectedWith('common.TokenValueTooLow');171 await expect(collection.transfer(alice, {Substrate: charlie.address}, 1n)).to.be.rejectedWith('common.TokenValueTooLow');172 await expect(collection.transfer(alice, {Substrate: charlie.address}, 10n)).to.be.rejectedWith('common.TokenValueTooLow');172 await expect(collection.transfer(alice, {Substrate: charlie.address}, 10n)).to.be.rejectedWith('common.TokenValueTooLow');173 await expect(collection.transfer(alice, {Substrate: charlie.address}, 100n)).to.be.rejectedWith('common.TokenValueTooLow');173 await expect(collection.transfer(alice, {Substrate: charlie.address}, 100n)).to.be.rejectedWith('common.TokenValueTooLow');176 await expect(nonExistingCollection.transfer(alice, {Substrate: charlie.address}, 0n)).to.be.rejectedWith('common.CollectionNotFound');176 await expect(nonExistingCollection.transfer(alice, {Substrate: charlie.address}, 0n)).to.be.rejectedWith('common.CollectionNotFound');177 await expect(nonExistingCollection.transfer(alice, {Substrate: charlie.address}, 1n)).to.be.rejectedWith('common.CollectionNotFound');177 await expect(nonExistingCollection.transfer(alice, {Substrate: charlie.address}, 1n)).to.be.rejectedWith('common.CollectionNotFound');178178179 // 3. Zero transfer not allowed:179 // 3. Zero transfer allowed (EIP-20):180 await expect(collection.transfer(bob, {Substrate: charlie.address}, 0n)).to.be.rejectedWith('common.ZeroTransferNotAllowed');180 await collection.transfer(bob, {Substrate: charlie.address}, 0n);181181182 expect(await collection.getBalance({Substrate: alice.address})).to.eq(0n);182 expect(await collection.getBalance({Substrate: alice.address})).to.eq(0n);183 expect(await collection.getBalance({Substrate: bob.address})).to.eq(10n);183 expect(await collection.getBalance({Substrate: bob.address})).to.eq(10n);tests/src/refungible.test.tsdiffbeforeafterboth276 const tokenBob = await collection.mintToken(alice, 10n, {Substrate: bob.address});276 const tokenBob = await collection.mintToken(alice, 10n, {Substrate: bob.address});277277278 // 1. Alice cannot transfer Bob's token:278 // 1. Alice cannot transfer Bob's token:279 await expect(tokenBob.transfer(alice, {Substrate: charlie.address}, 0n)).to.be.rejected;279 await expect(tokenBob.transfer(alice, {Substrate: charlie.address}, 0n)).to.be.rejectedWith('common.TokenValueTooLow');280 await expect(tokenBob.transfer(alice, {Substrate: charlie.address}, 1n)).to.be.rejected;280 await expect(tokenBob.transfer(alice, {Substrate: charlie.address}, 1n)).to.be.rejectedWith('common.TokenValueTooLow');281 await expect(tokenBob.transfer(alice, {Substrate: charlie.address}, 10n)).to.be.rejected;281 await expect(tokenBob.transfer(alice, {Substrate: charlie.address}, 10n)).to.be.rejectedWith('common.TokenValueTooLow');282 await expect(tokenBob.transfer(alice, {Substrate: charlie.address}, 100n)).to.be.rejected;282 await expect(tokenBob.transfer(alice, {Substrate: charlie.address}, 100n)).to.be.rejectedWith('common.TokenValueTooLow');283 283 284 // 2. Alice cannot transfer non-existing token:284 // 2. Alice cannot transfer non-existing token:285 await expect(collection.transferToken(alice, 100, {Substrate: charlie.address}, 0n)).to.be.rejected;285 await expect(collection.transferToken(alice, 100, {Substrate: charlie.address}, 0n)).to.be.rejectedWith('common.TokenValueTooLow');286 await expect(collection.transferToken(alice, 100, {Substrate: charlie.address}, 1n)).to.be.rejected;286 await expect(collection.transferToken(alice, 100, {Substrate: charlie.address}, 1n)).to.be.rejectedWith('common.TokenValueTooLow');287287288 // 3. Zero transfer not allowed:288 // 3. Zero transfer allowed (EIP-20):289 await expect(tokenAlice.transfer(alice, {Substrate: charlie.address}, 0n)).to.be.rejectedWith('common.ZeroTransferNotAllowed');289 await tokenAlice.transfer(alice, {Substrate: charlie.address}, 0n);290290291 expect(await tokenAlice.getTop10Owners()).to.deep.eq([{Substrate: alice.address}]);291 expect(await tokenAlice.getTop10Owners()).to.deep.eq([{Substrate: alice.address}]);292 expect(await tokenBob.getTop10Owners()).to.deep.eq([{Substrate: bob.address}]);292 expect(await tokenBob.getTop10Owners()).to.deep.eq([{Substrate: bob.address}]);