difftreelog
test cleanup debug logs
in: master
2 files changed
tests/src/contracts.test.tsdiffbeforeafterboth--- a/tests/src/contracts.test.ts
+++ b/tests/src/contracts.test.ts
@@ -64,15 +64,13 @@
const collectionId = await createCollectionExpectSuccess();
const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');
const [contract, deployer] = await deployTransferContract(api);
- const tokenBefore: any = (await api.query.nft.nftItemList(collectionId, tokenId) as any).unwrap();
+ const tokenBefore: any = (await api.query.nft.nftItemList(collectionId, tokenId) as any).toJSON();
// Transfer
- console.log('transfer using contract');
const transferTx = contract.tx.transfer(value, gasLimit, bob.address, collectionId, tokenId, 1);
const events = await submitTransactionAsync(alice, transferTx);
- console.log('done');
const result = getGenericResult(events);
- const tokenAfter: any = (await api.query.nft.nftItemList(collectionId, tokenId) as any).unwrap();
+ const tokenAfter: any = (await api.query.nft.nftItemList(collectionId, tokenId) as any).toJSON();
// tslint:disable-next-line:no-unused-expression
expect(result.success).to.be.true;
tests/src/removeCollectionAdmin.test.tsdiffbeforeafterboth1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { ApiPromise } from '@polkadot/api';7import chai from 'chai';8import chaiAsPromised from 'chai-as-promised';9import privateKey from './substrate/privateKey';10import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api';11import {createCollectionExpectSuccess, destroyCollectionExpectSuccess, normalizeAccountId} from './util/helpers';1213chai.use(chaiAsPromised);14const expect = chai.expect;1516describe('Integration Test removeCollectionAdmin(collection_id, account_id):', () => {17 it('Remove collection admin.', async () => {18 await usingApi(async (api: ApiPromise) => {19 const collectionId = await createCollectionExpectSuccess();20 const Alice = privateKey('//Alice');21 const Bob = privateKey('//Bob');22 const collection: any = (await api.query.nft.collectionById(collectionId)).toJSON();23 expect(collection.Owner).to.be.deep.eq(normalizeAccountId(Alice.address));24 // first - add collection admin Bob25 const addAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));26 await submitTransactionAsync(Alice, addAdminTx);2728 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId)).toJSON();29 console.log(adminListAfterAddAdmin);30 expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(Bob.address));3132 // then remove bob from admins of collection33 const removeAdminTx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(Bob.address));34 await submitTransactionAsync(Alice, removeAdminTx);3536 const adminListAfterRemoveAdmin: any = (await api.query.nft.adminList(collectionId)).toJSON;37 expect(adminListAfterRemoveAdmin).not.to.be.deep.contains(normalizeAccountId(Bob.address));38 });39 });4041 it('Remove admin from collection that has no admins', async () => {42 await usingApi(async (api: ApiPromise) => {43 const Alice = privateKey('//Alice');44 const collectionId = await createCollectionExpectSuccess();4546 const adminListBeforeAddAdmin: any = (await api.query.nft.adminList(collectionId));47 expect(adminListBeforeAddAdmin).to.have.lengthOf(0);4849 const tx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(Alice.address));50 await submitTransactionAsync(Alice, tx);51 });52 });53});5455describe('Negative Integration Test removeCollectionAdmin(collection_id, account_id):', () => {56 it('Can\'t remove collection admin from not existing collection', async () => {57 await usingApi(async (api: ApiPromise) => {58 // tslint:disable-next-line: no-bitwise59 const collectionId = (1 << 32) - 1;60 const alice = privateKey('//Alice');61 const bob = privateKey('//Bob');6263 const changeOwnerTx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));64 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;6566 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)67 await createCollectionExpectSuccess();68 });69 });7071 it('Can\'t remove collection admin from deleted collection', async () => {72 await usingApi(async (api: ApiPromise) => {73 // tslint:disable-next-line: no-bitwise74 const collectionId = await createCollectionExpectSuccess();75 const Alice = privateKey('//Alice');76 const Bob = privateKey('//Bob');7778 await destroyCollectionExpectSuccess(collectionId);7980 const changeOwnerTx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(Bob.address));81 await expect(submitTransactionExpectFailAsync(Alice, changeOwnerTx)).to.be.rejected;8283 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)84 await createCollectionExpectSuccess();85 });86 });87});