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.tsdiffbeforeafterboth217 });217 });218 });218 });219220 it('Burn a token in a destroyed collection', async () => {221 const createMode = 'NFT';222 const collectionId = await createCollectionExpectSuccess({mode: {type: createMode}});223 const tokenId = await createItemExpectSuccess(alice, collectionId, createMode);224 await destroyCollectionExpectSuccess(collectionId);225226 await usingApi(async (api) => {227 const tx = api.tx.unique.burnItem(collectionId, tokenId, 0);228 const badTransaction = async function () {229 await submitTransactionExpectFailAsync(alice, tx);230 };231 await expect(badTransaction()).to.be.rejected;232 });233234 });235219236 it('Burn a token that was never created', async () => {220 it('Burn a token that was never created', async () => {237 const createMode = 'NFT';221 const createMode = 'NFT';tests/src/check-event/createMultipleItemsEvent.test.tsdiffbeforeafterboth39 it('Check event from createMultipleItems(): ', async () => {39 it('Check event from createMultipleItems(): ', async () => {40 await usingApi(async (api: ApiPromise) => {40 await usingApi(async (api: ApiPromise) => {41 const collectionID = await createCollectionExpectSuccess();41 const collectionID = await createCollectionExpectSuccess();42 const args = [{NFT: ['0x31', '0x31']}, {NFT: ['0x32', '0x32']}, {NFT: ['0x33', '0x33']}];42 const args = [{NFT: {}}, {NFT: {}}, {NFT: {}}];43 const createMultipleItems = api.tx.unique.createMultipleItems(collectionID, normalizeAccountId(alice.address), args);43 const createMultipleItems = api.tx.unique.createMultipleItems(collectionID, normalizeAccountId(alice.address), args);44 const events = await submitTransactionAsync(alice, createMultipleItems);44 const events = await submitTransactionAsync(alice, createMultipleItems);45 const msg = JSON.stringify(uniqueEventMessage(events));45 const msg = JSON.stringify(uniqueEventMessage(events));tests/src/createCollection.test.tsdiffbeforeafterboth63 const bob = privateKey('//Bob');63 const bob = privateKey('//Bob');64 const tx = api.tx.unique.createCollectionEx({64 const tx = api.tx.unique.createCollectionEx({65 mode: {Fungible: 8},65 mode: {Fungible: 8},66 //access: 'AllowList',66 permissions: {67 access: 'AllowList'68 },67 name: [1],69 name: [1],68 description: [2],70 description: [2],69 tokenPrefix: '0x000000',71 tokenPrefix: '0x000000',70 //offchainSchema: '0x111111',71 //schemaVersion: 'Unique',72 pendingSponsor: bob.address,72 pendingSponsor: bob.address,73 limits: {73 limits: {74 accountTokenOwnershipLimit: 3,74 accountTokenOwnershipLimit: 3,75 },75 },76 //constOnChainSchema: '0x333333',77 });76 });78 const events = await submitTransactionAsync(alice, tx);77 const events = await submitTransactionAsync(alice, tx);79 const result = getCreateCollectionResult(events);78 const result = getCreateCollectionResult(events);807981 const collection = (await getDetailedCollectionInfo(api, result.collectionId))!;80 const collection = (await getDetailedCollectionInfo(api, result.collectionId))!;82 expect(collection.owner.toString()).to.equal(alice.address);81 expect(collection.owner.toString()).to.equal(alice.address);83 expect(collection.mode.asFungible.toNumber()).to.equal(8);82 expect(collection.mode.asFungible.toNumber()).to.equal(8);84 //expect(collection.access.isAllowList).to.be.true;83 expect(collection.permissions.access.toHuman()).to.equal('AllowList');85 expect(collection.name.map(v => v.toNumber())).to.deep.equal([1]);84 expect(collection.name.map(v => v.toNumber())).to.deep.equal([1]);86 expect(collection.description.map(v => v.toNumber())).to.deep.equal([2]);85 expect(collection.description.map(v => v.toNumber())).to.deep.equal([2]);87 expect(collection.tokenPrefix.toString()).to.equal('0x000000');86 expect(collection.tokenPrefix.toString()).to.equal('0x000000');88 //expect(collection.offchainSchema.toString()).to.equal('0x111111');89 //expect(collection.schemaVersion.isUnique).to.be.true;90 expect(collection.sponsorship.asUnconfirmed.toString()).to.equal(bob.address);87 expect(collection.sponsorship.asUnconfirmed.toString()).to.equal(bob.address);91 expect(collection.limits.accountTokenOwnershipLimit.unwrap().toNumber()).to.equal(3);88 expect(collection.limits.accountTokenOwnershipLimit.unwrap().toNumber()).to.equal(3);92 //expect(collection.constOnChainSchema.toString()).to.equal('0x333333');93 });89 });94 });90 });95});91});tests/src/limits.test.tsdiffbeforeafterboth27 createItemExpectFailure,27 createItemExpectFailure,28 transferExpectSuccess,28 transferExpectSuccess,29 getFreeBalance,29 getFreeBalance,30 waitNewBlocks,30 waitNewBlocks, burnItemExpectSuccess,31} from './util/helpers';31} from './util/helpers';32import {expect} from 'chai';32import {expect} from 'chai';333348 await createItemExpectSuccess(alice, collectionId, 'NFT');48 await createItemExpectSuccess(alice, collectionId, 'NFT');49 }49 }50 await createItemExpectFailure(alice, collectionId, 'NFT');50 await createItemExpectFailure(alice, collectionId, 'NFT');51 for(let i = 1; i < 11; i++) {52 await burnItemExpectSuccess(alice, collectionId, i);53 }51 await destroyCollectionExpectSuccess(collectionId);54 await destroyCollectionExpectSuccess(collectionId);52 });55 });535657 await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 1});60 await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 1});58 await createItemExpectSuccess(alice, collectionId, 'NFT');61 await createItemExpectSuccess(alice, collectionId, 'NFT');59 await createItemExpectFailure(alice, collectionId, 'NFT');62 await createItemExpectFailure(alice, collectionId, 'NFT');63 await burnItemExpectSuccess(alice, collectionId, 1);60 await destroyCollectionExpectSuccess(collectionId);64 await destroyCollectionExpectSuccess(collectionId);61 });65 });62});66});77 await createItemExpectSuccess(alice, collectionId, 'ReFungible');81 await createItemExpectSuccess(alice, collectionId, 'ReFungible');78 }82 }79 await createItemExpectFailure(alice, collectionId, 'ReFungible');83 await createItemExpectFailure(alice, collectionId, 'ReFungible');84 for(let i = 1; i < 11; i++) {85 await burnItemExpectSuccess(alice, collectionId, i, 100);86 }80 await destroyCollectionExpectSuccess(collectionId);87 await destroyCollectionExpectSuccess(collectionId);81 });88 });828985 await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 1});92 await setCollectionLimitsExpectSuccess(alice, collectionId, {accountTokenOwnershipLimit: 1});86 await createItemExpectSuccess(alice, collectionId, 'ReFungible');93 await createItemExpectSuccess(alice, collectionId, 'ReFungible');87 await createItemExpectFailure(alice, collectionId, 'ReFungible');94 await createItemExpectFailure(alice, collectionId, 'ReFungible');95 await burnItemExpectSuccess(alice, collectionId, 1, 100);88 await destroyCollectionExpectSuccess(collectionId);96 await destroyCollectionExpectSuccess(collectionId);89 });97 });90});98});tests/src/nextSponsoring.test.tsdiffbeforeafterboth686869 // After transfer69 // After transfer70 await transferExpectSuccess(collectionId, itemId, alice, bob, 1);70 await transferExpectSuccess(collectionId, itemId, alice, bob, 1);71 expect(await getNextSponsored(api, collectionId, normalizeAccountId(alice), itemId)).to.be.equal(5);71 expect(await getNextSponsored(api, collectionId, normalizeAccountId(alice), itemId)).to.be.lessThanOrEqual(5);727273 // Not existing token 73 // Not existing token 74 expect(await getNextSponsored(api, collectionId, normalizeAccountId(alice), itemId+1)).to.be.equal(-1);74 expect(await getNextSponsored(api, collectionId, normalizeAccountId(alice), itemId+1)).to.be.equal(-1);86 expect(await getNextSponsored(api, funCollectionId, normalizeAccountId(alice), 0)).to.be.equal(0);86 expect(await getNextSponsored(api, funCollectionId, normalizeAccountId(alice), 0)).to.be.equal(0);878788 await transferExpectSuccess(funCollectionId, 0, alice, bob, 10, 'Fungible');88 await transferExpectSuccess(funCollectionId, 0, alice, bob, 10, 'Fungible');89 expect(await getNextSponsored(api, funCollectionId, normalizeAccountId(alice), 0)).to.be.equal(5);89 expect(await getNextSponsored(api, funCollectionId, normalizeAccountId(alice), 0)).to.be.lessThanOrEqual(5);90 });90 });91 });91 });9292101 expect(await getNextSponsored(api, refunCollectionId, normalizeAccountId(alice), refunItemId)).to.be.equal(0);101 expect(await getNextSponsored(api, refunCollectionId, normalizeAccountId(alice), refunItemId)).to.be.equal(0);102102103 await transferExpectSuccess(refunCollectionId, refunItemId, alice, bob, 10, 'ReFungible');103 await transferExpectSuccess(refunCollectionId, refunItemId, alice, bob, 10, 'ReFungible');104 expect(await getNextSponsored(api, refunCollectionId, normalizeAccountId(alice), refunItemId)).to.be.equal(5);104 expect(await getNextSponsored(api, refunCollectionId, normalizeAccountId(alice), refunItemId)).to.be.lessThanOrEqual(5);105105106 // Not existing token 106 // Not existing token 107 expect(await getNextSponsored(api, refunCollectionId, normalizeAccountId(alice), refunItemId+1)).to.be.equal(-1);107 expect(await getNextSponsored(api, refunCollectionId, normalizeAccountId(alice), refunItemId+1)).to.be.equal(-1);tests/src/transfer.test.tsdiffbeforeafterboth168 // nft168 // nft169 const nftCollectionId = await createCollectionExpectSuccess();169 const nftCollectionId = await createCollectionExpectSuccess();170 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');170 const newNftTokenId = await createItemExpectSuccess(alice, nftCollectionId, 'NFT');171 await burnItemExpectSuccess(alice, nftCollectionId, newNftTokenId);171 await destroyCollectionExpectSuccess(nftCollectionId);172 await destroyCollectionExpectSuccess(nftCollectionId);172 await transferExpectFailure(nftCollectionId, newNftTokenId, alice, bob, 1);173 await transferExpectFailure(nftCollectionId, newNftTokenId, alice, bob, 1);173 // fungible174 // fungible174 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});175 const fungibleCollectionId = await createCollectionExpectSuccess({mode: {type: 'Fungible', decimalPoints: 0}});175 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');176 const newFungibleTokenId = await createItemExpectSuccess(alice, fungibleCollectionId, 'Fungible');177 await burnItemExpectSuccess(alice, fungibleCollectionId, newFungibleTokenId, 10);176 await destroyCollectionExpectSuccess(fungibleCollectionId);178 await destroyCollectionExpectSuccess(fungibleCollectionId);177 await transferExpectFailure(fungibleCollectionId, newFungibleTokenId, alice, bob, 1);179 await transferExpectFailure(fungibleCollectionId, newFungibleTokenId, alice, bob, 1);178 // reFungible180 // reFungible179 const reFungibleCollectionId = await181 const reFungibleCollectionId = await180 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});182 createCollectionExpectSuccess({mode: {type: 'ReFungible'}});181 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');183 const newReFungibleTokenId = await createItemExpectSuccess(alice, reFungibleCollectionId, 'ReFungible');184 await burnItemExpectSuccess(alice, reFungibleCollectionId, newReFungibleTokenId, 100);182 await destroyCollectionExpectSuccess(reFungibleCollectionId);185 await destroyCollectionExpectSuccess(reFungibleCollectionId);183 await transferExpectFailure(186 await transferExpectFailure(184 reFungibleCollectionId,187 reFungibleCollectionId,