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
--- a/tests/src/collision-tests/adminRightsOff.test.ts
+++ b/tests/src/collision-tests/adminRightsOff.test.ts
@@ -1,3 +1,5 @@
+/* obsolete
+
 import { IKeyringPair } from '@polkadot/types/types';
 import BN from 'bn.js';
 import chai from 'chai';
@@ -46,3 +48,5 @@
     });
   });
 });
+
+*/
\ No newline at end of file
modifiedtests/src/collision-tests/tokenLimitsOff.test.tsdiffbeforeafterboth
before · tests/src/collision-tests/tokenLimitsOff.test.ts
1import { IKeyringPair } from '@polkadot/types/types';2import BN from 'bn.js';3import chai from 'chai';4import chaiAsPromised from 'chai-as-promised';5import privateKey from '../substrate/privateKey';6import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';7import {8  addToWhiteListExpectSuccess,9  createCollectionExpectSuccess,10  getCreateItemResult,11  setMintPermissionExpectSuccess,12  normalizeAccountId,13  waitNewBlocks,14} from '../util/helpers';1516chai.use(chaiAsPromised);17const expect = chai.expect;18let Alice: IKeyringPair;19let Bob: IKeyringPair;20let Ferdie: IKeyringPair;2122const accountTokenOwnershipLimit = 4;23const sponsoredMintSize = 4294967295;24const tokenLimit = 4;25const sponsorTimeout = 14400;26const ownerCanTransfer = false;27const ownerCanDestroy = false;2829before(async () => {30  await usingApi(async () => {31    Alice = privateKey('//Alice');32    Bob = privateKey('//Bob');33    Ferdie = privateKey('//Ferdie');34  });35});3637describe('Token limit exceeded collection: ', () => {38  // tslint:disable-next-line: max-line-length39  it('The number of tokens created in the collection from different addresses exceeds the allowed collection limit ', async () => {40    await usingApi(async (api) => {41      const collectionId = await createCollectionExpectSuccess();42      await setMintPermissionExpectSuccess(Alice, collectionId, true);43      await addToWhiteListExpectSuccess(Alice, collectionId, Ferdie.address);44      await addToWhiteListExpectSuccess(Alice, collectionId, Bob.address);45      const setCollectionLim = api.tx.nft.setCollectionLimits(46        collectionId,47        {48          accountTokenOwnershipLimit,49          sponsoredMintSize,50          tokenLimit,51          // tslint:disable-next-line: object-literal-sort-keys52          sponsorTimeout,53          ownerCanTransfer,54          ownerCanDestroy,55        },56      );57      const subTx = await submitTransactionAsync(Alice, setCollectionLim);58      const subTxTesult = getCreateItemResult(subTx);59      // tslint:disable-next-line:no-unused-expression60      expect(subTxTesult.success).to.be.true;61      await waitNewBlocks(2);6263      const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];64      const mintItemOne = api.tx.nft65        .createMultipleItems(collectionId, normalizeAccountId(Ferdie.address), args);66      const mintItemTwo = api.tx.nft67        .createMultipleItems(collectionId, normalizeAccountId(Bob.address), args);68      await Promise.all([69        mintItemOne.signAndSend(Ferdie),70        mintItemTwo.signAndSend(Bob),71      ]);72      await waitNewBlocks(2);73      const itemsListIndexAfter = await api.query.nft.itemListIndex(collectionId) as unknown as BN;74      expect(itemsListIndexAfter.toNumber()).to.be.equal(3);75      // TokenLimit = 4. The first transaction is successful. The second should fail.76      await waitNewBlocks(2);77    });78  });79});
after · tests/src/collision-tests/tokenLimitsOff.test.ts
1/* obsolete2import { IKeyringPair } from '@polkadot/types/types';3import BN from 'bn.js';4import chai from 'chai';5import chaiAsPromised from 'chai-as-promised';6import privateKey from '../substrate/privateKey';7import usingApi, { submitTransactionAsync } from '../substrate/substrate-api';8import {9  addToWhiteListExpectSuccess,10  createCollectionExpectSuccess,11  getCreateItemResult,12  setMintPermissionExpectSuccess,13  normalizeAccountId,14  waitNewBlocks,15} from '../util/helpers';1617chai.use(chaiAsPromised);18const expect = chai.expect;19let Alice: IKeyringPair;20let Bob: IKeyringPair;21let Ferdie: IKeyringPair;2223const accountTokenOwnershipLimit = 4;24const sponsoredMintSize = 4294967295;25const tokenLimit = 4;26const sponsorTimeout = 14400;27const ownerCanTransfer = false;28const ownerCanDestroy = false;2930before(async () => {31  await usingApi(async () => {32    Alice = privateKey('//Alice');33    Bob = privateKey('//Bob');34    Ferdie = privateKey('//Ferdie');35  });36});3738describe('Token limit exceeded collection: ', () => {39  // tslint:disable-next-line: max-line-length40  it('The number of tokens created in the collection from different addresses exceeds the allowed collection limit ', async () => {41    await usingApi(async (api) => {42      const collectionId = await createCollectionExpectSuccess();43      await setMintPermissionExpectSuccess(Alice, collectionId, true);44      await addToWhiteListExpectSuccess(Alice, collectionId, Ferdie.address);45      await addToWhiteListExpectSuccess(Alice, collectionId, Bob.address);46      const setCollectionLim = api.tx.nft.setCollectionLimits(47        collectionId,48        {49          accountTokenOwnershipLimit,50          sponsoredMintSize,51          tokenLimit,52          // tslint:disable-next-line: object-literal-sort-keys53          sponsorTimeout,54          ownerCanTransfer,55          ownerCanDestroy,56        },57      );58      const subTx = await submitTransactionAsync(Alice, setCollectionLim);59      const subTxTesult = getCreateItemResult(subTx);60      // tslint:disable-next-line:no-unused-expression61      expect(subTxTesult.success).to.be.true;62      await waitNewBlocks(2);6364      const args = [{ nft: ['0x31', '0x31'] }, { nft: ['0x32', '0x32'] }, { nft: ['0x33', '0x33'] }];65      const mintItemOne = api.tx.nft66        .createMultipleItems(collectionId, normalizeAccountId(Ferdie.address), args);67      const mintItemTwo = api.tx.nft68        .createMultipleItems(collectionId, normalizeAccountId(Bob.address), args);69      await Promise.all([70        mintItemOne.signAndSend(Ferdie),71        mintItemTwo.signAndSend(Bob),72      ]);73      await waitNewBlocks(2);74      const itemsListIndexAfter = await api.query.nft.itemListIndex(collectionId) as unknown as BN;75      expect(itemsListIndexAfter.toNumber()).to.be.equal(3);76      // TokenLimit = 4. The first transaction is successful. The second should fail.77      await waitNewBlocks(2);78    });79  });80});81*/