difftreelog
Merge branch 'develop' into feature/NFTPAR-236_burn_item
in: master
3 files changed
tests/package.jsondiffbeforeafterboth--- a/tests/package.json
+++ b/tests/package.json
@@ -20,6 +20,7 @@
"load": "mocha --timeout 9999999 -r ts-node/register ./**/*.load.ts",
"testSetSchemaVersion": "mocha --timeout 9999999 -r ts-node/register ./**/setSchemaVersion.test.ts",
"testSetCollectionLimits": "mocha --timeout 9999999 -r ts-node/register ./**/setCollectionLimits.test.ts",
+ "testRemoveCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionAdmin.test.ts",
"testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",
"testCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts"
},
tests/src/removeCollectionAdmin.test.tsdiffbeforeafterboth1import { ApiPromise } from '@polkadot/api';2import BN from 'bn.js';3import chai from 'chai';4import chaiAsPromised from 'chai-as-promised';5import privateKey from './substrate/privateKey';6import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api';7import {createCollectionExpectSuccess, destroyCollectionExpectSuccess} from './util/helpers';89chai.use(chaiAsPromised);10const expect = chai.expect;1112describe('Integration Test removeCollectionAdmin(collection_id, account_id):', () => {13 it('Remove collection admin.', async () => {14 await usingApi(async (api: ApiPromise) => {15 const collectionId = await createCollectionExpectSuccess();16 const Alice = privateKey('//Alice');17 const Bob = privateKey('//Bob');18 const collection: any = (await api.query.nft.collection(collectionId));19 expect(collection.Owner.toString()).to.be.eq(Alice.address);20 // first - add collection admin Bob21 const addAdminTx = api.tx.nft.addCollectionAdmin(collectionId, Bob.address);22 await submitTransactionAsync(Alice, addAdminTx);2324 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));25 expect(adminListAfterAddAdmin).to.be.contains(Bob.address);2627 // then remove bob from admins of collection28 const removeAdminTx = api.tx.nft.removeCollectionAdmin(collectionId, Bob.address);29 await submitTransactionAsync(Alice, removeAdminTx);3031 const adminListAfterRemoveAdmin: any = (await api.query.nft.adminList(collectionId));32 expect(adminListAfterRemoveAdmin).not.to.be.contains(Bob.address);33 });34 });35});3637describe('Negative Integration Test removeCollectionAdmin(collection_id, account_id):', () => {38 it('Can\'t remove collection admin from not existing collection', async () => {39 await usingApi(async (api: ApiPromise) => {40 // tslint:disable-next-line: no-bitwise41 const collectionId = (1 << 32) - 1;42 const alice = privateKey('//Alice');43 const bob = privateKey('//Bob');4445 const changeOwnerTx = api.tx.nft.removeCollectionAdmin(collectionId, bob.address);46 await expect(submitTransactionExpectFailAsync(alice, changeOwnerTx)).to.be.rejected;4748 // Verifying that nothing bad happened (network is live, new collections can be created, etc.)49 await createCollectionExpectSuccess();50 });51 });5253 it('Can\'t remove collection admin from deleted collection', async () => {54 await usingApi(async (api: ApiPromise) => {55 // tslint:disable-next-line: no-bitwise56 const collectionId = await createCollectionExpectSuccess();57 const Alice = privateKey('//Alice');58 const Bob = privateKey('//Bob');5960 await destroyCollectionExpectSuccess(collectionId);6162 const changeOwnerTx = api.tx.nft.removeCollectionAdmin(collectionId, 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('Remove admin from collection that has no admins', async () => {71 await usingApi(async (api: ApiPromise) => {72 const Alice = privateKey('//Alice');73 const collectionId = await createCollectionExpectSuccess();7475 const adminListBeforeAddAdmin: any = (await api.query.nft.adminList(collectionId));76 expect(adminListBeforeAddAdmin).to.have.lengthOf(0);7778 const tx = api.tx.nft.removeCollectionAdmin(collectionId, Alice.address);79 await expect(submitTransactionExpectFailAsync(Alice, tx)).to.be.rejected;80 });81 });82});tests/src/setSchemaVersion.test.tsdiffbeforeafterboth--- a/tests/src/setSchemaVersion.test.ts
+++ b/tests/src/setSchemaVersion.test.ts
@@ -93,12 +93,6 @@
const nonExistedCollectionId = collectionCount + 1;
tx = api.tx.nft.setSchemaVersion(nonExistedCollectionId, 'ImageURL');
await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;
- /*try {
- await submitTransactionAsync(alice, tx);
- } catch (e) {
- // tslint:disable-next-line:no-unused-expression
- expect(e).to.be.exist;
- }*/
});
});
@@ -119,13 +113,6 @@
await destroyCollectionExpectSuccess(collectionIdForTesting);
tx = api.tx.nft.setSchemaVersion(collectionIdForTesting, 'ImageURL');
await expect(submitTransactionExpectFailAsync(alice, tx)).to.be.rejected;
- /*try {
- tx = api.tx.nft.setSchemaVersion(collectionIdForTesting, 'ImageURL');
- await submitTransactionAsync(alice, tx);
- } catch (e) {
- // tslint:disable-next-line:no-unused-expression
- expect(e).to.be.exist;
- }*/
});
});
});