difftreelog
CORE-238 Refactor test
in: master
2 files changed
tests/package.jsondiffbeforeafterboth67 "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",67 "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",68 "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",68 "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",69 "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",69 "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",70 "testLimits": "mocha --timeout 9999999 -r ts-node/register ./**/limits.test.ts",70 "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",71 "polkadot-types-fetch-metadata": "curl -H 'Content-Type: application/json' -d '{\"id\":\"1\", \"jsonrpc\":\"2.0\", \"method\": \"state_getMetadata\", \"params\":[]}' http://localhost:9933 > src/interfaces/metadata.json",71 "polkadot-types-from-defs": "echo 'export default {}' > src/interfaces/lookup.ts && ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",72 "polkadot-types-from-defs": "echo 'export default {}' > src/interfaces/lookup.ts && ts-node ./node_modules/.bin/polkadot-types-from-defs --endpoint src/interfaces/metadata.json --input src/interfaces/ --package .",72 "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",73 "polkadot-types-from-chain": "ts-node ./node_modules/.bin/polkadot-types-from-chain --endpoint src/interfaces/metadata.json --output src/interfaces/ --package .",tests/src/limits.test.tsdiffbeforeafterboth355 });355 });356});356});357358describe('Collection zero limits (ReFungible)', () => {359 let alice: IKeyringPair;360 let bob: IKeyringPair;361 let charlie: IKeyringPair;362363 before(async () => {364 await usingApi(async () => {365 alice = privateKey('//Alice');366 bob = privateKey('//Bob');367 charlie = privateKey('//Charlie');368 });369 });370371 it.skip('Limits have 0 in tokens per address field, the chain limits are applied', async () => {372 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});373 await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 0});374 for(let i = 0; i < 10; i++){375 await createItemExpectSuccess(alice, collectionId, 'ReFungible');376 }377 await createItemExpectFailure(alice, collectionId, 'ReFungible');378 });379380 it('Limits have 0 in sponsor timeout, no limits are applied', async () => {381382 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});383 await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 0});384 const tokenId = await createItemExpectSuccess(alice, collectionId, 'ReFungible');385 await setCollectionSponsorExpectSuccess(collectionId, alice.address);386 await confirmSponsorshipExpectSuccess(collectionId, '//Alice');387 await transferExpectSuccess(collectionId, tokenId, alice, bob, 100, 'ReFungible');388 await transferExpectSuccess(collectionId, tokenId, bob, charlie, 20, 'ReFungible');389 const aliceBalanceBefore = await getFreeBalance(alice);390391 // check setting SponsorTimeout = 0, success with next block392 await waitNewBlocks(1);393 await transferExpectSuccess(collectionId, tokenId, bob, charlie, 20, 'ReFungible');394 const aliceBalanceAfterSponsoredTransaction1 = await getFreeBalance(alice);395 expect(aliceBalanceAfterSponsoredTransaction1 < aliceBalanceBefore).to.be.true;396 //expect(aliceBalanceAfterSponsoredTransaction1).to.be.lessThan(aliceBalanceBefore);397 });398});399357400describe('Effective collection limits', () => {358describe('Collection zero limits (ReFungible)', () => {359 let alice: IKeyringPair;360 let bob: IKeyringPair;361 let charlie: IKeyringPair;362363 before(async () => {364 await usingApi(async () => {365 alice = privateKey('//Alice');366 bob = privateKey('//Bob');367 charlie = privateKey('//Charlie');368 });369 });370371 it.skip('Limits have 0 in tokens per address field, the chain limits are applied', async () => {372 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});373 await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 0});374 for(let i = 0; i < 10; i++){375 await createItemExpectSuccess(alice, collectionId, 'ReFungible');376 }377 await createItemExpectFailure(alice, collectionId, 'ReFungible');378 });379380 it('Limits have 0 in sponsor timeout, no limits are applied', async () => {381382 const collectionId = await createCollectionExpectSuccess({mode: {type: 'ReFungible'}});383 await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 0});384 const tokenId = await createItemExpectSuccess(alice, collectionId, 'ReFungible');385 await setCollectionSponsorExpectSuccess(collectionId, alice.address);386 await confirmSponsorshipExpectSuccess(collectionId, '//Alice');387 await transferExpectSuccess(collectionId, tokenId, alice, bob, 100, 'ReFungible');388 await transferExpectSuccess(collectionId, tokenId, bob, charlie, 20, 'ReFungible');389 const aliceBalanceBefore = await getFreeBalance(alice);390391 // check setting SponsorTimeout = 0, success with next block392 await waitNewBlocks(1);393 await transferExpectSuccess(collectionId, tokenId, bob, charlie, 20, 'ReFungible');394 const aliceBalanceAfterSponsoredTransaction1 = await getFreeBalance(alice);395 expect(aliceBalanceAfterSponsoredTransaction1 < aliceBalanceBefore).to.be.true;396 //expect(aliceBalanceAfterSponsoredTransaction1).to.be.lessThan(aliceBalanceBefore);397 });398 401 it('Test1', async () => {399 it('Effective collection limits', async () => {402 await usingApi(async (api) => {400 await usingApi(async (api) => {403 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});401 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});404 402