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 expect(adminListAfterAddAdmin).to.be.deep.contains(normalizeAccountId(Bob.address));3031 // then remove bob from admins of collection32 const removeAdminTx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(Bob.address));33 await submitTransactionAsync(Alice, removeAdminTx);3435 const adminListAfterRemoveAdmin: any = (await api.query.nft.adminList(collectionId)).toJSON;36 expect(adminListAfterRemoveAdmin).not.to.be.deep.contains(normalizeAccountId(Bob.address));37 });38 });3940 it('Remove admin from collection that has no admins', async () => {41 await usingApi(async (api: ApiPromise) => {42 const Alice = privateKey('//Alice');43 const collectionId = await createCollectionExpectSuccess();4445 const adminListBeforeAddAdmin: any = (await api.query.nft.adminList(collectionId));46 expect(adminListBeforeAddAdmin).to.have.lengthOf(0);4748 const tx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(Alice.address));49 await submitTransactionAsync(Alice, tx);50 });51 });52});5354describe('Negative Integration Test removeCollectionAdmin(collection_id, account_id):', () => {55 it('Can\'t remove collection admin from not existing collection', async () => {56 await usingApi(async (api: ApiPromise) => {57 // tslint:disable-next-line: no-bitwise58 const collectionId = (1 << 32) - 1;59 const alice = privateKey('//Alice');60 const bob = privateKey('//Bob');6162 const changeOwnerTx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(bob.address));63 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;6465 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)66 await createCollectionExpectSuccess();67 });68 });6970 it('Can\'t remove collection admin from deleted collection', async () => {71 await usingApi(async (api: ApiPromise) => {72 // tslint:disable-next-line: no-bitwise73 const collectionId = await createCollectionExpectSuccess();74 const Alice = privateKey('//Alice');75 const Bob = privateKey('//Bob');7677 await destroyCollectionExpectSuccess(collectionId);7879 const changeOwnerTx = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(Bob.address));80 await expect(submitTransactionExpectFailAsync(Alice, changeOwnerTx)).to.be.rejected;8182 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)83 await createCollectionExpectSuccess();84 });85 });86});