From dccf12785096c099d0825ade45b659a036402633 Mon Sep 17 00:00:00 2001 From: kpozdnikin Date: Tue, 19 Jan 2021 14:02:10 +0000 Subject: [PATCH] transferFail --- --- a/tests/src/transfer.test.ts +++ b/tests/src/transfer.test.ts @@ -19,7 +19,7 @@ transferExpectSuccess, } from './util/helpers'; -/*describe('Integration Test Transfer(recipient, collection_id, item_id, value)', () => { +describe('Integration Test Transfer(recipient, collection_id, item_id, value)', () => { it('Balance transfers and check balance', async () => { await usingApi(async (api: ApiPromise) => { const [alicesBalanceBefore, bobsBalanceBefore] = await getBalance(api, [alicesPublicKey, bobsPublicKey]); @@ -78,10 +78,10 @@ newReFungibleTokenId, Alice, Bob, 1, 'ReFungible'); }); }); -});*/ +}); describe('Negative Integration Test Transfer(recipient, collection_id, item_id, value)', () => { - /*it('Transfer with not existed collection_id', async () => { + it('Transfer with not existed collection_id', async () => { await usingApi(async (api: ApiPromise) => { const Alice = privateKey('//Alice'); const Bob = privateKey('//Bob'); @@ -158,7 +158,7 @@ await transferExpectFail(reFungibleCollectionId, newReFungibleTokenId, Alice, Bob, 1, 'ReFungible'); }); - });*/ + }); it('Transfer with recipient that is not owner', async () => { await usingApi(async (api: ApiPromise) => { const Alice = privateKey('//Alice'); --- a/tests/src/util/helpers.ts +++ b/tests/src/util/helpers.ts @@ -521,9 +521,11 @@ await usingApi(async (api: ApiPromise) => { const transferTx = await api.tx.nft.transfer(recipient.address, collectionId, tokenId, value); const events = await expect(submitTransactionExpectFailAsync(sender, transferTx)).to.be.rejected; - const result = getCreateCollectionResult(events); - // tslint:disable-next-line:no-unused-expression - expect(result.success).to.be.false; + if (events && Array.isArray(events)) { + const result = getCreateCollectionResult(events); + // tslint:disable-next-line:no-unused-expression + expect(result.success).to.be.false; + } }); } @@ -627,6 +629,7 @@ const collection: any = (await api.query.nft.collection(collectionId)).toJSON(); // What to expect + // tslint:disable-next-line:no-unused-expression expect(result.success).to.be.true; expect(collection.MintMode).to.be.equal(true); }); -- gitstuff