git.delta.rocks / unique-network / refs/commits / 200a8c66fee4

difftreelog

tests fix

kpozdnikin2021-01-12parent: #ff0be54.patch.diff
in: master

2 files changed

modifiedtests/package.jsondiffbeforeafterboth
17 },17 },
18 "scripts": {18 "scripts": {
19 "test": "mocha --timeout 9999999 -r ts-node/register ./**/*.test.ts",19 "test": "mocha --timeout 9999999 -r ts-node/register ./**/*.test.ts",
20 "load": "mocha --timeout 9999999 -r ts-node/register ./**/*.load.ts"20 "load": "mocha --timeout 9999999 -r ts-node/register ./**/*.load.ts",
21 "testAddCollectionAdmin": "mocha --timeout 9999999 -r ts-node/register ./**/addCollectionAdmin.test.ts"
21 },22 },
22 "author": "",23 "author": "",
23 "license": "Apache 2.0",24 "license": "Apache 2.0",
modifiedtests/src/addCollectionAdmin.test.tsdiffbeforeafterboth
1import { ApiPromise } from '@polkadot/api';
2import BN from 'bn.js';
1import chai from 'chai'; 3import chai from 'chai';
2import chaiAsPromised from 'chai-as-promised'; 4import chaiAsPromised from 'chai-as-promised';
3import privateKey from './substrate/privateKey'; 5import privateKey from './substrate/privateKey';
58 }); 60 });
59 }); 61 });
62
63 it('Add an admin to a collection that has reached the maximum number of admins limit', async () => {
64 await usingApi(async (api: ApiPromise) => {
65 const Alice = privateKey('//Alice');
66 const accounts = [
67 'GsvVmjr1CBHwQHw84pPHMDxgNY3iBLz6Qn7qS3CH8qPhrHz',
68 'FoQJpPyadYccjavVdTWxpxU7rUEaYhfLCPwXgkfD6Zat9QP',
69 'JKspFU6ohf1Grg3Phdzj2pSgWvsYWzSfKghhfzMbdhNBWs5',
70 'JKspFU6ohf1Grg3Phdzj2pSgWvsYWzSfKghhfzMbdhNBWs5',
71 'Fr4NzY1udSFFLzb2R3qxVQkwz9cZraWkyfH4h3mVVk7BK7P',
72 'DfnTB4z7eUvYRqcGtTpFsLC69o6tvBSC1pEv8vWPZFtCkaK',
73 'HnMAUz7r2G8G3hB27SYNyit5aJmh2a5P4eMdDtACtMFDbam',
74 'DE14BzQ1bDXWPKeLoAqdLAm1GpyAWaWF1knF74cEZeomTBM',
75 ];
76 const collectionId = await createCollectionExpectSuccess();
77
78 const chainLimit = await api.query.nft.chainLimit() as unknown as { collections_admins_limit: BN };
79 const chainLimitNumber = chainLimit.collections_admins_limit.toNumber();
80 expect(chainLimitNumber).to.be.equal(5);
81
82 for (let i = 0; i < chainLimitNumber - 1; i++) {
83 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, accounts[i]);
84 await submitTransactionAsync(Alice, changeAdminTx);
85 const adminListAfterAddAdmin: any = (await api.query.nft.adminList(collectionId));
86 adminListAfterAddAdmin.map((item: any) => console.log(item.toString()));
87 expect(adminListAfterAddAdmin).to.be.contains(accounts[i]);
88 }
89
90 const tx = api.tx.nft.addCollectionAdmin(collectionId, accounts[chainLimitNumber - 1]);
91 await expect(submitTransactionExpectFailAsync(Alice, tx)).to.be.rejected;
92 });
93 });
60}); 94});
6195