difftreelog
Tests fixes sync
in: master
7 files changed
tests/package.jsondiffbeforeafterboth47 "testRemoveCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionSponsor.test.ts",47 "testRemoveCollectionSponsor": "mocha --timeout 9999999 -r ts-node/register ./**/removeCollectionSponsor.test.ts",48 "testRemoveFromAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromAllowList.test.ts",48 "testRemoveFromAllowList": "mocha --timeout 9999999 -r ts-node/register ./**/removeFromAllowList.test.ts",49 "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",49 "testConnection": "mocha --timeout 9999999 -r ts-node/register ./**/connection.test.ts",50 "testCollection": "mocha --timeout 9999999 -r ts-node/register ./**/createCollection.test.ts",51 "testContracts": "mocha --timeout 9999999 -r ts-node/register ./**/contracts.test.ts",50 "testContracts": "mocha --timeout 9999999 -r ts-node/register ./**/contracts.test.ts",52 "testCreateItem": "mocha --timeout 9999999 -r ts-node/register ./**/createItem.test.ts",51 "testCreateItem": "mocha --timeout 9999999 -r ts-node/register ./**/createItem.test.ts",53 "testCreateMultipleItems": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItems.test.ts",52 "testCreateMultipleItems": "mocha --timeout 9999999 -r ts-node/register ./**/createMultipleItems.test.ts",tests/src/burnItem.test.tsdiffbeforeafterboth--- a/tests/src/burnItem.test.ts
+++ b/tests/src/burnItem.test.ts
@@ -217,22 +217,6 @@
});
});
- it('Burn a token in a destroyed collection', async () => {
- const createMode = 'NFT';
- const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});
- const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);
- await destroyCollectionExpectSuccess(collectionId);
-
- await usingApi(async (api) => {
- const tx = api.tx.unique.burnItem(collectionId, tokenId, 0);
- const badTransaction = async function () {
- await submitTransactionExpectFailAsync(alice, tx);
- };
- await expect(badTransaction()).to.be.rejected;
- });
-
- });
-
it('Burn a token that was never created', async () => {
const createMode = 'NFT';
const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});
tests/src/check-event/createMultipleItemsEvent.test.tsdiffbeforeafterboth--- a/tests/src/check-event/createMultipleItemsEvent.test.ts
+++ b/tests/src/check-event/createMultipleItemsEvent.test.ts
@@ -39,7 +39,7 @@
it('Check event from createMultipleItems(): ', async () => {
await usingApi(async (api: ApiPromise) => {
const collectionID = await createCollectionExpectSuccess();
- const args = [{NFT: ['0x31', '0x31']}, {NFT: ['0x32', '0x32']}, {NFT: ['0x33', '0x33']}];
+ const args = [{NFT: {}}, {NFT: {}}, {NFT: {}}];
const createMultipleItems = api.tx.unique.createMultipleItems(collectionID, normalizeAccountId(alice.address), args);
const events = await submitTransactionAsync(alice, createMultipleItems);
const msg = JSON.stringify(uniqueEventMessage(events));
tests/src/createCollection.test.tsdiffbeforeafterboth--- a/tests/src/createCollection.test.ts
+++ b/tests/src/createCollection.test.ts
@@ -63,17 +63,16 @@
const bob = privateKey('//Bob');
const tx = api.tx.unique.createCollectionEx({
mode: {Fungible: 8},
- //access: 'AllowList',
+ permissions: {
+ access: 'AllowList'
+ },
name: [1],
description: [2],
tokenPrefix: '0x000000',
- //offchainSchema: '0x111111',
- //schemaVersion: 'Unique',
pendingSponsor: bob.address,
limits: {
accountTokenOwnershipLimit: 3,
},
- //constOnChainSchema: '0x333333',
});
const events = await submitTransactionAsync(alice, tx);
const result = getCreateCollectionResult(events);
@@ -81,15 +80,12 @@
const collection = (await getDetailedCollectionInfo(api, result.collectionId))!;
expect(collection.owner.toString()).to.equal(alice.address);
expect(collection.mode.asFungible.toNumber()).to.equal(8);
- //expect(collection.access.isAllowList).to.be.true;
+ expect(collection.permissions.access.toHuman()).to.equal('AllowList');
expect(collection.name.map(v => v.toNumber())).to.deep.equal([1]);
expect(collection.description.map(v => v.toNumber())).to.deep.equal([2]);
expect(collection.tokenPrefix.toString()).to.equal('0x000000');
- //expect(collection.offchainSchema.toString()).to.equal('0x111111');
- //expect(collection.schemaVersion.isUnique).to.be.true;
expect(collection.sponsorship.asUnconfirmed.toString()).to.equal(bob.address);
expect(collection.limits.accountTokenOwnershipLimit.unwrap().toNumber()).to.equal(3);
- //expect(collection.constOnChainSchema.toString()).to.equal('0x333333');
});
});
});
tests/src/limits.test.tsdiffbeforeafterboth--- a/tests/src/limits.test.ts
+++ b/tests/src/limits.test.ts
@@ -27,7 +27,7 @@
createItemExpectFailure,
transferExpectSuccess,
getFreeBalance,
- waitNewBlocks,
+ waitNewBlocks, burnItemExpectSuccess,
} from './util/helpers';
import {expect} from 'chai';
@@ -48,6 +48,9 @@
await createItemExpectSuccess(alice, collectionId, 'NFT');
}
await createItemExpectFailure(alice, collectionId, 'NFT');
+ for(let i = 1; i < 11; i++) {
+ await burnItemExpectSuccess(alice, collectionId, i);
+ }
await destroyCollectionExpectSuccess(collectionId);
});
@@ -57,6 +60,7 @@
await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 1});
await createItemExpectSuccess(alice, collectionId, 'NFT');
await createItemExpectFailure(alice, collectionId, 'NFT');
+ await burnItemExpectSuccess(alice, collectionId, 1);
await destroyCollectionExpectSuccess(collectionId);
});
});
@@ -77,6 +81,9 @@
await createItemExpectSuccess(alice, collectionId, 'ReFungible');
}
await createItemExpectFailure(alice, collectionId, 'ReFungible');
+ for(let i = 1; i < 11; i++) {
+ await burnItemExpectSuccess(alice, collectionId, i, 100);
+ }
await destroyCollectionExpectSuccess(collectionId);
});
@@ -85,6 +92,7 @@
await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 1});
await createItemExpectSuccess(alice, collectionId, 'ReFungible');
await createItemExpectFailure(alice, collectionId, 'ReFungible');
+ await burnItemExpectSuccess(alice, collectionId, 1, 100);
await destroyCollectionExpectSuccess(collectionId);
});
});
tests/src/nextSponsoring.test.tsdiffbeforeafterboth--- a/tests/src/nextSponsoring.test.ts
+++ b/tests/src/nextSponsoring.test.ts
@@ -68,7 +68,7 @@
// After transfer
await transferExpectSuccess(collectionId, itemId, alice, bob, 1);
- expect(await getNextSponsored(api, collectionId, normalizeAccountId(alice), itemId)).to.be.equal(5);
+ expect(await getNextSponsored(api, collectionId, normalizeAccountId(alice), itemId)).to.be.lessThanOrEqual(5);
// Not existing token
expect(await getNextSponsored(api, collectionId, normalizeAccountId(alice), itemId+1)).to.be.equal(-1);
@@ -86,7 +86,7 @@
expect(await getNextSponsored(api, funCollectionId, normalizeAccountId(alice), 0)).to.be.equal(0);
await transferExpectSuccess(funCollectionId, 0, alice, bob, 10, 'Fungible');
- expect(await getNextSponsored(api, funCollectionId, normalizeAccountId(alice), 0)).to.be.equal(5);
+ expect(await getNextSponsored(api, funCollectionId, normalizeAccountId(alice), 0)).to.be.lessThanOrEqual(5);
});
});
@@ -101,7 +101,7 @@
expect(await getNextSponsored(api, refunCollectionId, normalizeAccountId(alice), refunItemId)).to.be.equal(0);
await transferExpectSuccess(refunCollectionId, refunItemId, alice, bob, 10, 'ReFungible');
- expect(await getNextSponsored(api, refunCollectionId, normalizeAccountId(alice), refunItemId)).to.be.equal(5);
+ expect(await getNextSponsored(api, refunCollectionId, normalizeAccountId(alice), refunItemId)).to.be.lessThanOrEqual(5);
// Not existing token
expect(await getNextSponsored(api, refunCollectionId, normalizeAccountId(alice), refunItemId+1)).to.be.equal(-1);
tests/src/transfer.test.tsdiffbeforeafterboth--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -168,17 +168,20 @@
// nft
const nftCollectionId = await createCollectionExpectSuccess();
const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');
+ await burnItemExpectSuccess(alice, nftCollectionId, newNftTokenId);
await destroyCollectionExpectSuccess(nftCollectionId);
await transferExpectFailure(nftCollectionId, newNftTokenId, alice, bob, 1);
// fungible
const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});
const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');
+ await burnItemExpectSuccess(alice, fungibleCollectionId, newFungibleTokenId, 10);
await destroyCollectionExpectSuccess(fungibleCollectionId);
await transferExpectFailure(fungibleCollectionId, newFungibleTokenId, alice, bob, 1);
// reFungible
const reFungibleCollectionId = await
createCollectionExpectSuccess({mode: {type: 'ReFungible'}});
const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');
+ await burnItemExpectSuccess(alice, reFungibleCollectionId, newReFungibleTokenId, 100);
await destroyCollectionExpectSuccess(reFungibleCollectionId);
await transferExpectFailure(
reFungibleCollectionId,