git.delta.rocks / unique-network / refs/commits / 1c47062bc001

difftreelog

Can not transfer zero pieces

Max Andreev2022-12-02parent: #c07446f.patch.diff
in: master

1 file changed

modifiedtests/src/refungible.test.tsdiffbeforeafterboth
255 });255 });
256});256});
257
258describe('Refungible negative tests', () => {
259 let donor: IKeyringPair;
260 let alice: IKeyringPair;
261 let bob: IKeyringPair;
262 let charlie: IKeyringPair;
263
264 before(async function() {
265 await usingPlaygrounds(async (helper, privateKey) => {
266 requirePalletsOrSkip(this, helper, [Pallets.ReFungible]);
267
268 donor = await privateKey({filename: __filename});
269 [alice, bob, charlie] = await helper.arrange.createAccounts([100n, 100n, 100n], donor);
270 });
271 });
272
273 itSub('Cannot transfer incorrect amount of token pieces', async ({helper}) => {
274 const collection = await helper.rft.mintCollection(alice, {name: 'test', description: 'test', tokenPrefix: 'test'});
275 const tokenAlice = await collection.mintToken(alice, 10n, {Substrate: alice.address});
276 const tokenBob = await collection.mintToken(alice, 10n, {Substrate: bob.address});
277
278 // Alice cannot transfer Bob's token:
279 await expect(tokenBob.transfer(alice, {Substrate: charlie.address}, 0n)).to.be.rejected;
280 await expect(tokenBob.transfer(alice, {Substrate: charlie.address}, 1n)).to.be.rejected;
281 await expect(tokenBob.transfer(alice, {Substrate: charlie.address}, 10n)).to.be.rejected;
282 await expect(tokenBob.transfer(alice, {Substrate: charlie.address}, 100n)).to.be.rejected;
283
284 // Alice cannot transfer non-existing token:
285 await expect(collection.transferToken(alice, 100, {Substrate: charlie.address}, 0n)).to.be.rejected;
286 await expect(collection.transferToken(alice, 100, {Substrate: charlie.address}, 1n)).to.be.rejected;
287
288 expect(await tokenAlice.getTop10Owners()).to.deep.eq([{Substrate: alice.address}]);
289 expect(await tokenBob.getTop10Owners()).to.deep.eq([{Substrate: bob.address}]);
290 expect(await tokenAlice.getBalance({Substrate: alice.address})).to.eq(10n);
291 expect(await tokenBob.getBalance({Substrate: bob.address})).to.eq(10n);
292 expect(await tokenBob.getBalance({Substrate: charlie.address})).to.eq(0n);
293 });
294});
257295
258