git.delta.rocks / unique-network / refs/commits / 82fab32327b7

difftreelog

disable logically broken tests

Igor Kozyrev2021-11-08parent: #a5e777f.patch.diff
in: master

2 files changed

modifiedtests/src/collision-tests/adminRightsOff.test.tsdiffbeforeafterboth
1import { IKeyringPair } from '@polkadot/types/types';1/* obsolete
2import BN from 'bn.js';2
3import chai from 'chai';3import { IKeyringPair } from '@polkadot/types/types';
4import chaiAsPromised from 'chai-as-promised';4import BN from 'bn.js';
5import privateKey from '../substrate/privateKey';5import chai from 'chai';
6import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';6import chaiAsPromised from 'chai-as-promised';
7import {7import privateKey from '../substrate/privateKey';
8 createCollectionExpectSuccess,8import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
9 normalizeAccountId,9import {
10 waitNewBlocks,10 createCollectionExpectSuccess,
11} from '../util/helpers';11 normalizeAccountId,
1212 waitNewBlocks,
13chai.use(chaiAsPromised);13} from '../util/helpers';
14const expect = chai.expect;14
15let Alice: IKeyringPair;15chai.use(chaiAsPromised);
16let Bob: IKeyringPair;16const expect = chai.expect;
1717let Alice: IKeyringPair;
18before(async () => {18let Bob: IKeyringPair;
19 await usingApi(async () => {19
20 Alice = privateKey('//Alice');20before(async () => {
21 Bob = privateKey('//Bob');21 await usingApi(async () => {
22 });22 Alice = privateKey('//Alice');
23});23 Bob = privateKey('//Bob');
2424 });
25describe('Deprivation of admin rights: ', () => {25});
26 // tslint:disable-next-line: max-line-length26
27 it('In the block, the collection admin adds a token or changes data, and the collection owner deprives the admin of rights ', async () => {27describe('Deprivation of admin rights: ', () => {
28 await usingApi(async (api) => {28 // tslint:disable-next-line: max-line-length
29 const collectionId = await createCollectionExpectSuccess();29 it('In the block, the collection admin adds a token or changes data, and the collection owner deprives the admin of rights ', async () => {
30 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));30 await usingApi(async (api) => {
31 await submitTransactionAsync(Alice, changeAdminTx);31 const collectionId = await createCollectionExpectSuccess();
32 await waitNewBlocks(1);32 const changeAdminTx = api.tx.nft.addCollectionAdmin(collectionId, normalizeAccountId(Bob.address));
33 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];33 await submitTransactionAsync(Alice, changeAdminTx);
34 const addItemAdm = api.tx.nft.createMultipleItems(collectionId, normalizeAccountId(Bob.address), args);34 await waitNewBlocks(1);
35 const removeAdm = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(Bob.address));35 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];
36 await Promise.all([36 const addItemAdm = api.tx.nft.createMultipleItems(collectionId, normalizeAccountId(Bob.address), args);
37 addItemAdm.signAndSend(Bob),37 const removeAdm = api.tx.nft.removeCollectionAdmin(collectionId, normalizeAccountId(Bob.address));
38 removeAdm.signAndSend(Alice),38 await Promise.all([
39 ]);39 addItemAdm.signAndSend(Bob),
40 await waitNewBlocks(2);40 removeAdm.signAndSend(Alice),
41 const itemsListIndex = await api.query.nft.itemListIndex(collectionId) as unknown as BN;41 ]);
42 expect(itemsListIndex.toNumber()).to.be.equal(0);42 await waitNewBlocks(2);
43 const adminList: any = (await api.query.nft.adminList(collectionId));43 const itemsListIndex = await api.query.nft.itemListIndex(collectionId) as unknown as BN;
44 expect(adminList).not.to.be.contains(normalizeAccountId(Bob.address));44 expect(itemsListIndex.toNumber()).to.be.equal(0);
45 await waitNewBlocks(2);45 const adminList: any = (await api.query.nft.adminList(collectionId));
46 });46 expect(adminList).not.to.be.contains(normalizeAccountId(Bob.address));
47 });47 await waitNewBlocks(2);
48});48 });
4949 });
50});
51
52*/
modifiedtests/src/collision-tests/tokenLimitsOff.test.tsdiffbeforeafterboth
1import { IKeyringPair } from '@polkadot/types/types';1/* obsolete
2import BN from 'bn.js';2import { IKeyringPair } from '@polkadot/types/types';
3import chai from 'chai';3import BN from 'bn.js';
4import chaiAsPromised from 'chai-as-promised';4import chai from 'chai';
5import privateKey from '../substrate/privateKey';5import chaiAsPromised from 'chai-as-promised';
6import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';6import privateKey from '../substrate/privateKey';
7import {7import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';
8 addToWhiteListExpectSuccess,8import {
9 createCollectionExpectSuccess,9 addToWhiteListExpectSuccess,
10 getCreateItemResult,10 createCollectionExpectSuccess,
11 setMintPermissionExpectSuccess,11 getCreateItemResult,
12 normalizeAccountId,12 setMintPermissionExpectSuccess,
13 waitNewBlocks,13 normalizeAccountId,
14} from '../util/helpers';14 waitNewBlocks,
1515} from '../util/helpers';
16chai.use(chaiAsPromised);16
17const expect = chai.expect;17chai.use(chaiAsPromised);
18let Alice: IKeyringPair;18const expect = chai.expect;
19let Bob: IKeyringPair;19let Alice: IKeyringPair;
20let Ferdie: IKeyringPair;20let Bob: IKeyringPair;
2121let Ferdie: IKeyringPair;
22const accountTokenOwnershipLimit = 4;22
23const sponsoredMintSize = 4294967295;23const accountTokenOwnershipLimit = 4;
24const tokenLimit = 4;24const sponsoredMintSize = 4294967295;
25const sponsorTimeout = 14400;25const tokenLimit = 4;
26const ownerCanTransfer = false;26const sponsorTimeout = 14400;
27const ownerCanDestroy = false;27const ownerCanTransfer = false;
2828const ownerCanDestroy = false;
29before(async () => {29
30 await usingApi(async () => {30before(async () => {
31 Alice = privateKey('//Alice');31 await usingApi(async () => {
32 Bob = privateKey('//Bob');32 Alice = privateKey('//Alice');
33 Ferdie = privateKey('//Ferdie');33 Bob = privateKey('//Bob');
34 });34 Ferdie = privateKey('//Ferdie');
35});35 });
3636});
37describe('Token limit exceeded collection: ', () => {37
38 // tslint:disable-next-line: max-line-length38describe('Token limit exceeded collection: ', () => {
39 it('The number of tokens created in the collection from different addresses exceeds the allowed collection limit ', async () => {39 // tslint:disable-next-line: max-line-length
40 await usingApi(async (api) => {40 it('The number of tokens created in the collection from different addresses exceeds the allowed collection limit ', async () => {
41 const collectionId = await createCollectionExpectSuccess();41 await usingApi(async (api) => {
42 await setMintPermissionExpectSuccess(Alice, collectionId, true);42 const collectionId = await createCollectionExpectSuccess();
43 await addToWhiteListExpectSuccess(Alice, collectionId, Ferdie.address);43 await setMintPermissionExpectSuccess(Alice, collectionId, true);
44 await addToWhiteListExpectSuccess(Alice, collectionId, Bob.address);44 await addToWhiteListExpectSuccess(Alice, collectionId, Ferdie.address);
45 const setCollectionLim = api.tx.nft.setCollectionLimits(45 await addToWhiteListExpectSuccess(Alice, collectionId, Bob.address);
46 collectionId,46 const setCollectionLim = api.tx.nft.setCollectionLimits(
47 {47 collectionId,
48 accountTokenOwnershipLimit,48 {
49 sponsoredMintSize,49 accountTokenOwnershipLimit,
50 tokenLimit,50 sponsoredMintSize,
51 // tslint:disable-next-line: object-literal-sort-keys51 tokenLimit,
52 sponsorTimeout,52 // tslint:disable-next-line: object-literal-sort-keys
53 ownerCanTransfer,53 sponsorTimeout,
54 ownerCanDestroy,54 ownerCanTransfer,
55 },55 ownerCanDestroy,
56 );56 },
57 const subTx = await submitTransactionAsync(Alice, setCollectionLim);57 );
58 const subTxTesult = getCreateItemResult(subTx);58 const subTx = await submitTransactionAsync(Alice, setCollectionLim);
59 // tslint:disable-next-line:no-unused-expression59 const subTxTesult = getCreateItemResult(subTx);
60 expect(subTxTesult.success).to.be.true;60 // tslint:disable-next-line:no-unused-expression
61 await waitNewBlocks(2);61 expect(subTxTesult.success).to.be.true;
6262 await waitNewBlocks(2);
63 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];63
64 const mintItemOne = api.tx.nft64 const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];
65 .createMultipleItems(collectionId, normalizeAccountId(Ferdie.address), args);65 const mintItemOne = api.tx.nft
66 const mintItemTwo = api.tx.nft66 .createMultipleItems(collectionId, normalizeAccountId(Ferdie.address), args);
67 .createMultipleItems(collectionId, normalizeAccountId(Bob.address), args);67 const mintItemTwo = api.tx.nft
68 await Promise.all([68 .createMultipleItems(collectionId, normalizeAccountId(Bob.address), args);
69 mintItemOne.signAndSend(Ferdie),69 await Promise.all([
70 mintItemTwo.signAndSend(Bob),70 mintItemOne.signAndSend(Ferdie),
71 ]);71 mintItemTwo.signAndSend(Bob),
72 await waitNewBlocks(2);72 ]);
73 const itemsListIndexAfter = await api.query.nft.itemListIndex(collectionId) as unknown as BN;73 await waitNewBlocks(2);
74 expect(itemsListIndexAfter.toNumber()).to.be.equal(3);74 const itemsListIndexAfter = await api.query.nft.itemListIndex(collectionId) as unknown as BN;
75 // TokenLimit = 4. The first transaction is successful. The second should fail.75 expect(itemsListIndexAfter.toNumber()).to.be.equal(3);
76 await waitNewBlocks(2);76 // TokenLimit = 4. The first transaction is successful. The second should fail.
77 });77 await waitNewBlocks(2);
78 });78 });
79});79 });
80});
81*/
8082