difftreelog
Remove asyncs without awaits
in: master
23 files changed
tests/src/addCollectionAdmin.test.tsdiffbeforeafterboth--- a/tests/src/addCollectionAdmin.test.ts
+++ b/tests/src/addCollectionAdmin.test.ts
@@ -56,8 +56,8 @@
const collection = await helper.collection.getData(collectionId);
expect(collection?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(alice.address));
- const changeAdminTxBob = async () => helper.collection.addAdmin(bob, collectionId, {Substrate: bob.address});
- const changeAdminTxCharlie = async () => helper.collection.addAdmin(bob, collectionId, {Substrate: charlie.address});
+ const changeAdminTxBob = () => helper.collection.addAdmin(bob, collectionId, {Substrate: bob.address});
+ const changeAdminTxCharlie = () => helper.collection.addAdmin(bob, collectionId, {Substrate: charlie.address});
await expect(changeAdminTxCharlie()).to.be.rejectedWith(/common\.NoPermission/);
await expect(changeAdminTxBob()).to.be.rejectedWith(/common\.NoPermission/);
@@ -75,7 +75,7 @@
const adminListAfterAddAdmin = await collection.getAdmins();
expect(adminListAfterAddAdmin).to.be.deep.contains({Substrate: bob.address});
- const changeAdminTxCharlie = async () => collection.addAdmin(bob, {Substrate: charlie.address});
+ const changeAdminTxCharlie = () => collection.addAdmin(bob, {Substrate: charlie.address});
await expect(changeAdminTxCharlie()).to.be.rejectedWith(/common\.NoPermission/);
const adminListAfterAddNewAdmin = await collection.getAdmins();
@@ -87,7 +87,7 @@
const [alice, bob] = await helper.arrange.createAccounts([10n, 10n, 10n], donor);
const collectionId = (1 << 32) - 1;
- const addAdminTx = async () => helper.collection.addAdmin(alice, collectionId, {Substrate: bob.address});
+ const addAdminTx = () => helper.collection.addAdmin(alice, collectionId, {Substrate: bob.address});
await expect(addAdminTx()).to.be.rejectedWith(/common\.CollectionNotFound/);
// Verifying that nothing bad happened (network is live, new collections can be created, etc.)
@@ -99,7 +99,7 @@
const collection = await helper.nft.mintCollection(alice, {name: 'Collection Name', description: 'Collection Description', tokenPrefix: 'COL'});
await collection.burn(alice);
- const addAdminTx = async () => collection.addAdmin(alice, {Substrate: bob.address});
+ const addAdminTx = () => collection.addAdmin(alice, {Substrate: bob.address});
await expect(addAdminTx()).to.be.rejectedWith(/common\.CollectionNotFound/);
// Verifying that nothing bad happened (network is live, new collections can be created, etc.)
@@ -119,7 +119,7 @@
expect(adminListAfterAddAdmin).to.be.deep.contains({Substrate: accounts[i].address});
}
- const addExtraAdminTx = async () => collection.addAdmin(alice, {Substrate: accounts[chainAdminLimit].address});
+ const addExtraAdminTx = () => collection.addAdmin(alice, {Substrate: accounts[chainAdminLimit].address});
await expect(addExtraAdminTx()).to.be.rejectedWith(/common\.CollectionAdminCountExceeded/);
});
});
tests/src/adminTransferAndBurn.test.tsdiffbeforeafterboth--- a/tests/src/adminTransferAndBurn.test.ts
+++ b/tests/src/adminTransferAndBurn.test.ts
@@ -36,7 +36,7 @@
expect(limits.ownerCanTransfer).to.be.true;
const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
- const transferResult = async () => helper.nft.transferToken(alice, collectionId, tokenId, {Substrate: charlie.address});
+ const transferResult = () => helper.nft.transferToken(alice, collectionId, tokenId, {Substrate: charlie.address});
await expect(transferResult()).to.be.rejected;
await helper.nft.transferTokenFrom(alice, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address});
@@ -52,7 +52,7 @@
expect(limits.ownerCanTransfer).to.be.true;
const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
- const burnTxFailed = async () => helper.nft.burnToken(alice, collectionId, tokenId);
+ const burnTxFailed = () => helper.nft.burnToken(alice, collectionId, tokenId);
await expect(burnTxFailed()).to.be.rejected;
tests/src/allowLists.test.tsdiffbeforeafterboth--- a/tests/src/allowLists.test.ts
+++ b/tests/src/allowLists.test.ts
@@ -30,7 +30,7 @@
});
});
- describe('Positive', async () => {
+ describe('Positive', () => {
itSub('Owner can add address to allow list', async ({helper}) => {
const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
// allow list does not need to be enabled to add someone in advance
@@ -58,7 +58,7 @@
});
});
- describe('Negative', async () => {
+ describe('Negative', () => {
itSub('Nobody can add address to allow list of non-existing collection', async ({helper}) => {
const collectionId = (1<<32) - 1;
await expect(helper.nft.addToAllowList(bob, collectionId, {Substrate: charlie.address}))
@@ -92,7 +92,7 @@
});
});
- describe('Positive', async () => {
+ describe('Positive', () => {
itSub('Owner can remove address from allow list', async ({helper}) => {
const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await helper.nft.addToAllowList(alice, collectionId, {Substrate: bob.address});
@@ -128,7 +128,7 @@
});
});
- describe('Negative', async () => {
+ describe('Negative', () => {
itSub('Non-privileged user cannot remove address from allow list', async ({helper}) => {
const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await helper.nft.addToAllowList(alice, collectionId, {Substrate: charlie.address});
@@ -168,7 +168,7 @@
});
});
- describe('Positive', async () => {
+ describe('Positive', () => {
itSub('If Public Access mode is set to AllowList, tokens can be transferred to a allowlisted address with transfer.', async ({helper}) => {
const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
@@ -219,7 +219,7 @@
});
});
- describe('Negative', async () => {
+ describe('Negative', () => {
itSub('If Public Access mode is set to AllowList, tokens can\'t be transferred from a non-allowlisted address with transfer or transferFrom. Test1', async ({helper}) => {
const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
@@ -303,7 +303,7 @@
{access: 'AllowList', mintMode: true},
];
- const testPermissionSuite = async (permissions: ICollectionPermissions) => {
+ const testPermissionSuite = (permissions: ICollectionPermissions) => {
const allowlistedMintingShouldFail = !permissions.mintMode!;
const appropriateRejectionMessage = permissions.mintMode! ? /common\.AddressNotInAllowlist/ : /common\.PublicMintingNotAllowed/;
@@ -323,8 +323,8 @@
);
- describe(`Public Access Mode = ${permissions.access}, Mint Mode = ${permissions.mintMode}`, async () => {
- describe('Positive', async () => {
+ describe(`Public Access Mode = ${permissions.access}, Mint Mode = ${permissions.mintMode}`, () => {
+ describe('Positive', () => {
itSub('With the condtions above, tokens can be created by owner', async ({helper}) => {
const collection = await helper.nft.mintCollection(alice, {});
await collection.setPermissions(alice, permissions);
@@ -341,7 +341,7 @@
if (!allowlistedMintingShouldFail) allowlistedMintingTest();
});
- describe('Negative', async () => {
+ describe('Negative', () => {
itSub('With the condtions above, tokens can\'t be created by non-priviliged non-allow-listed address', async ({helper}) => {
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await collection.setPermissions(alice, permissions);
tests/src/approve.test.tsdiffbeforeafterboth--- a/tests/src/approve.test.ts
+++ b/tests/src/approve.test.ts
@@ -92,7 +92,7 @@
itSub('can`t be called by collection owner on non-owned item when OwnerCanTransfer == false', async ({helper}) => {
const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
- const approveTokenTx = async () => helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: charlie.address});
+ const approveTokenTx = () => helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: charlie.address});
await expect(approveTokenTx()).to.be.rejected;
});
});
@@ -196,7 +196,7 @@
await helper.nft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
const owner = await helper.nft.getTokenOwner(collectionId, tokenId);
expect(owner.Substrate).to.be.equal(alice.address);
- const transferTokenFromTx = async () => helper.nft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
+ const transferTokenFromTx = () => helper.nft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
await expect(transferTokenFromTx()).to.be.rejected;
});
@@ -210,7 +210,7 @@
const after = await helper.ft.getBalance(collectionId, {Substrate: alice.address});
expect(after - before).to.be.equal(BigInt(1));
- const transferTokenFromTx = async () => helper.ft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 1n);
+ const transferTokenFromTx = () => helper.ft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 1n);
await expect(transferTokenFromTx()).to.be.rejected;
});
@@ -222,7 +222,7 @@
await helper.rft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 100n);
const after = await helper.rft.getTokenBalance(collectionId, tokenId, {Substrate: alice.address});
expect(after - before).to.be.equal(BigInt(100));
- const transferTokenFromTx = async () => helper.rft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 100n);
+ const transferTokenFromTx = () => helper.rft.transferTokenFrom(charlie, collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address}, 100n);
await expect(transferTokenFromTx()).to.be.rejected;
});
});
@@ -277,7 +277,7 @@
expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.true;
await helper.signTransaction(alice, helper.constructApiCall('api.tx.unique.approve', [{Substrate: bob.address}, collectionId, tokenId, 0]));
expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: bob.address})).to.be.false;
- const transferTokenFromTx = async () => helper.nft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: bob.address});
+ const transferTokenFromTx = () => helper.nft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: bob.address});
await expect(transferTokenFromTx()).to.be.rejected;
});
@@ -293,7 +293,7 @@
const amountAfter = await helper.ft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
expect(amountAfter).to.be.equal(BigInt(0));
- const transferTokenFromTx = async () => helper.ft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address}, 1n);
+ const transferTokenFromTx = () => helper.ft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address}, 1n);
await expect(transferTokenFromTx()).to.be.rejected;
});
@@ -308,7 +308,7 @@
const amountAfter = await helper.rft.getTokenApprovedPieces(collectionId, tokenId, {Substrate: bob.address}, {Substrate: alice.address});
expect(amountAfter).to.be.equal(BigInt(0));
- const transferTokenFromTx = async () => helper.rft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address}, 100n);
+ const transferTokenFromTx = () => helper.rft.transferTokenFrom(bob, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address}, 100n);
await expect(transferTokenFromTx()).to.be.rejected;
});
});
@@ -328,7 +328,7 @@
itSub('1 for NFT', async ({helper}) => {
const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
- const approveTx = async () => helper.signTransaction(bob, helper.constructApiCall('api.tx.unique.approve', [{Substrate: charlie.address}, collectionId, tokenId, 2]));
+ const approveTx = () => helper.signTransaction(bob, helper.constructApiCall('api.tx.unique.approve', [{Substrate: charlie.address}, collectionId, tokenId, 2]));
await expect(approveTx()).to.be.rejected;
expect(await helper.nft.isTokenApproved(collectionId, tokenId, {Substrate: charlie.address})).to.be.false;
});
@@ -337,14 +337,14 @@
const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
const tokenId = await helper.ft.getLastTokenId(collectionId);
- const approveTx = async () => helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 11n);
+ const approveTx = () => helper.ft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 11n);
await expect(approveTx()).to.be.rejected;
});
itSub.ifWithPallets('ReFungible', [Pallets.ReFungible], async ({helper}) => {
const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
- const approveTx = async () => helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 101n);
+ const approveTx = () => helper.rft.approveToken(alice, collectionId, tokenId, {Substrate: bob.address}, 101n);
await expect(approveTx()).to.be.rejected;
});
});
@@ -483,7 +483,7 @@
const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
await helper.collection.addAdmin(alice, collectionId, {Substrate: bob.address});
- const approveTx = async () => helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
+ const approveTx = () => helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: charlie.address});
await expect(approveTx()).to.be.rejected;
});
});
@@ -502,59 +502,59 @@
itSub('[nft] Approve for a collection that does not exist', async ({helper}) => {
const collectionId = 1 << 32 - 1;
- const approveTx = async () => helper.nft.approveToken(bob, collectionId, 1, {Substrate: charlie.address});
+ const approveTx = () => helper.nft.approveToken(bob, collectionId, 1, {Substrate: charlie.address});
await expect(approveTx()).to.be.rejected;
});
itSub('[fungible] Approve for a collection that does not exist', async ({helper}) => {
const collectionId = 1 << 32 - 1;
- const approveTx = async () => helper.ft.approveToken(bob, collectionId, 1, {Substrate: charlie.address});
+ const approveTx = () => helper.ft.approveToken(bob, collectionId, 1, {Substrate: charlie.address});
await expect(approveTx()).to.be.rejected;
});
itSub.ifWithPallets('[refungible] Approve for a collection that does not exist', [Pallets.ReFungible], async ({helper}) => {
const collectionId = 1 << 32 - 1;
- const approveTx = async () => helper.rft.approveToken(bob, collectionId, 1, {Substrate: charlie.address});
+ const approveTx = () => helper.rft.approveToken(bob, collectionId, 1, {Substrate: charlie.address});
await expect(approveTx()).to.be.rejected;
});
itSub('[nft] Approve for a collection that was destroyed', async ({helper}) => {
const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await helper.nft.burn(alice, collectionId);
- const approveTx = async () => helper.nft.approveToken(alice, collectionId, 1, {Substrate: bob.address});
+ const approveTx = () => helper.nft.approveToken(alice, collectionId, 1, {Substrate: bob.address});
await expect(approveTx()).to.be.rejected;
});
itSub('[fungible] Approve for a collection that was destroyed', async ({helper}) => {
const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await helper.ft.burn(alice, collectionId);
- const approveTx = async () => helper.ft.approveToken(alice, collectionId, 1, {Substrate: bob.address});
+ const approveTx = () => helper.ft.approveToken(alice, collectionId, 1, {Substrate: bob.address});
await expect(approveTx()).to.be.rejected;
});
itSub.ifWithPallets('[refungible] Approve for a collection that was destroyed', [Pallets.ReFungible], async ({helper}) => {
const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await helper.rft.burn(alice, collectionId);
- const approveTx = async () => helper.rft.approveToken(alice, collectionId, 1, {Substrate: bob.address});
+ const approveTx = () => helper.rft.approveToken(alice, collectionId, 1, {Substrate: bob.address});
await expect(approveTx()).to.be.rejected;
});
itSub('[nft] Approve transfer of a token that does not exist', async ({helper}) => {
const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const approveTx = async () => helper.nft.approveToken(alice, collectionId, 2, {Substrate: bob.address});
+ const approveTx = () => helper.nft.approveToken(alice, collectionId, 2, {Substrate: bob.address});
await expect(approveTx()).to.be.rejected;
});
itSub.ifWithPallets('[refungible] Approve transfer of a token that does not exist', [Pallets.ReFungible], async ({helper}) => {
const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const approveTx = async () => helper.rft.approveToken(alice, collectionId, 2, {Substrate: bob.address});
+ const approveTx = () => helper.rft.approveToken(alice, collectionId, 2, {Substrate: bob.address});
await expect(approveTx()).to.be.rejected;
});
itSub('[nft] Approve using the address that does not own the approved token', async ({helper}) => {
const {collectionId} = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: alice.address});
- const approveTx = async () => helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address});
+ const approveTx = () => helper.nft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address});
await expect(approveTx()).to.be.rejected;
});
@@ -562,14 +562,14 @@
const {collectionId} = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await helper.ft.mintTokens(alice, collectionId, 10n, alice.address);
const tokenId = await helper.ft.getLastTokenId(collectionId);
- const approveTx = async () => helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address});
+ const approveTx = () => helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address});
await expect(approveTx()).to.be.rejected;
});
itSub.ifWithPallets('[refungible] Approve using the address that does not own the approved token', [Pallets.ReFungible], async ({helper}) => {
const {collectionId} = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
const {tokenId} = await helper.rft.mintToken(alice, {collectionId: collectionId, owner: alice.address, pieces: 100n});
- const approveTx = async () => helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address});
+ const approveTx = () => helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address});
await expect(approveTx()).to.be.rejected;
});
@@ -579,7 +579,7 @@
await helper.rft.transferToken(alice, collectionId, tokenId, {Substrate: bob.address}, 100n);
await helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 100n);
- const approveTx = async () => helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 101n);
+ const approveTx = () => helper.rft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 101n);
await expect(approveTx()).to.be.rejected;
});
@@ -590,7 +590,7 @@
await helper.ft.transferToken(alice, collectionId, tokenId, {Substrate: bob.address}, 10n);
await helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 10n);
- const approveTx = async () => helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 11n);
+ const approveTx = () => helper.ft.approveToken(bob, collectionId, tokenId, {Substrate: alice.address}, 11n);
await expect(approveTx()).to.be.rejected;
});
@@ -599,7 +599,7 @@
const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});
await helper.collection.setLimits(alice, collectionId, {ownerCanTransfer: false});
- const approveTx = async () => helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: charlie.address});
+ const approveTx = () => helper.nft.approveToken(alice, collectionId, tokenId, {Substrate: charlie.address});
await expect(approveTx()).to.be.rejected;
});
});
tests/src/change-collection-owner.test.tsdiffbeforeafterboth--- a/tests/src/change-collection-owner.test.ts
+++ b/tests/src/change-collection-owner.test.ts
@@ -56,7 +56,7 @@
await collection.changeOwner(alice, bob.address);
- const changeOwnerTx = async () => collection.changeOwner(alice, alice.address);
+ const changeOwnerTx = () => collection.changeOwner(alice, alice.address);
await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);
const afterChanging = await helper.collection.getData(collection.collectionId);
@@ -115,20 +115,20 @@
itSub('Not owner can\'t change owner.', async ({helper}) => {
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const changeOwnerTx = async () => collection.changeOwner(bob, bob.address);
+ const changeOwnerTx = () => collection.changeOwner(bob, bob.address);
await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);
});
itSub('Collection admin can\'t change owner.', async ({helper}) => {
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await collection.addAdmin(alice, {Substrate: bob.address});
- const changeOwnerTx = async () => collection.changeOwner(bob, bob.address);
+ const changeOwnerTx = () => collection.changeOwner(bob, bob.address);
await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);
});
itSub('Can\'t change owner of a non-existing collection.', async ({helper}) => {
const collectionId = (1 << 32) - 1;
- const changeOwnerTx = async () => helper.collection.changeOwner(bob, collectionId, bob.address);
+ const changeOwnerTx = () => helper.collection.changeOwner(bob, collectionId, bob.address);
await expect(changeOwnerTx()).to.be.rejectedWith(/common\.CollectionNotFound/);
});
@@ -136,15 +136,15 @@
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await collection.changeOwner(alice, bob.address);
- const changeOwnerTx = async () => collection.changeOwner(alice, alice.address);
+ const changeOwnerTx = () => collection.changeOwner(alice, alice.address);
await expect(changeOwnerTx()).to.be.rejectedWith(/common\.NoPermission/);
const afterChanging = await helper.collection.getData(collection.collectionId);
expect(afterChanging?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(bob.address));
- const setSponsorTx = async () => collection.setSponsor(alice, charlie.address);
- const confirmSponsorshipTx = async () => collection.confirmSponsorship(alice);
- const removeSponsorTx = async () => collection.removeSponsor(alice);
+ const setSponsorTx = () => collection.setSponsor(alice, charlie.address);
+ const confirmSponsorshipTx = () => collection.confirmSponsorship(alice);
+ const removeSponsorTx = () => collection.removeSponsor(alice);
await expect(setSponsorTx()).to.be.rejectedWith(/common\.NoPermission/);
await expect(confirmSponsorshipTx()).to.be.rejectedWith(/unique\.ConfirmUnsetSponsorFail/);
await expect(removeSponsorTx()).to.be.rejectedWith(/common\.NoPermission/);
@@ -157,13 +157,13 @@
ownerCanTransfer: true,
};
- const setLimitsTx = async () => collection.setLimits(alice, limits);
+ const setLimitsTx = () => collection.setLimits(alice, limits);
await expect(setLimitsTx()).to.be.rejectedWith(/common\.NoPermission/);
- const setPermissionTx = async () => collection.setPermissions(alice, {access: 'AllowList', mintMode: true});
+ const setPermissionTx = () => collection.setPermissions(alice, {access: 'AllowList', mintMode: true});
await expect(setPermissionTx()).to.be.rejectedWith(/common\.NoPermission/);
- const burnTx = async () => collection.burn(alice);
+ const burnTx = () => collection.burn(alice);
await expect(burnTx()).to.be.rejectedWith(/common\.NoPermission/);
});
});
tests/src/confirmSponsorship.test.tsdiffbeforeafterboth--- a/tests/src/confirmSponsorship.test.ts
+++ b/tests/src/confirmSponsorship.test.ts
@@ -119,7 +119,7 @@
await token.transfer(alice, {Substrate: zeroBalance.address});
const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
- const transferTx = async () => token.transfer(zeroBalance, {Substrate: alice.address});
+ const transferTx = () => token.transfer(zeroBalance, {Substrate: alice.address});
await expect(transferTx()).to.be.rejectedWith('Inability to pay some fees');
const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
@@ -137,7 +137,7 @@
await collection.transfer(zeroBalance, {Substrate: zeroBalance.address}, 1n);
const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
- const transferTx = async () => collection.transfer(zeroBalance, {Substrate: zeroBalance.address});
+ const transferTx = () => collection.transfer(zeroBalance, {Substrate: zeroBalance.address});
await expect(transferTx()).to.be.rejected;
const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
@@ -155,7 +155,7 @@
await token.transfer(zeroBalance, {Substrate: alice.address});
const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
- const transferTx = async () => token.transfer(zeroBalance, {Substrate: alice.address});
+ const transferTx = () => token.transfer(zeroBalance, {Substrate: alice.address});
await expect(transferTx()).to.be.rejectedWith('Inability to pay some fees');
const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
@@ -175,7 +175,7 @@
await collection.mintToken(zeroBalance, {Substrate: zeroBalance.address});
const bobBalanceBefore = await helper.balance.getSubstrate(bob.address);
- const mintTx = async () => collection.mintToken(zeroBalance, {Substrate: zeroBalance.address});
+ const mintTx = () => collection.mintToken(zeroBalance, {Substrate: zeroBalance.address});
await expect(mintTx()).to.be.rejectedWith('Inability to pay some fees');
const bobBalanceAfter = await helper.balance.getSubstrate(bob.address);
@@ -199,21 +199,21 @@
itSub('(!negative test!) Confirm sponsorship for a collection that never existed', async ({helper}) => {
const collectionId = (1 << 32) - 1;
- const confirmSponsorshipTx = async () => helper.collection.confirmSponsorship(bob, collectionId);
+ const confirmSponsorshipTx = () => helper.collection.confirmSponsorship(bob, collectionId);
await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.CollectionNotFound/);
});
itSub('(!negative test!) Confirm sponsorship using a non-sponsor address', async ({helper}) => {
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await collection.setSponsor(alice, bob.address);
- const confirmSponsorshipTx = async () => collection.confirmSponsorship(charlie);
+ const confirmSponsorshipTx = () => collection.confirmSponsorship(charlie);
await expect(confirmSponsorshipTx()).to.be.rejectedWith(/unique\.ConfirmUnsetSponsorFail/);
});
itSub('(!negative test!) Confirm sponsorship using owner address', async ({helper}) => {
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await collection.setSponsor(alice, bob.address);
- const confirmSponsorshipTx = async () => collection.confirmSponsorship(alice);
+ const confirmSponsorshipTx = () => collection.confirmSponsorship(alice);
await expect(confirmSponsorshipTx()).to.be.rejectedWith(/unique\.ConfirmUnsetSponsorFail/);
});
@@ -221,20 +221,20 @@
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await collection.setSponsor(alice, bob.address);
await collection.addAdmin(alice, {Substrate: charlie.address});
- const confirmSponsorshipTx = async () => collection.confirmSponsorship(charlie);
+ const confirmSponsorshipTx = () => collection.confirmSponsorship(charlie);
await expect(confirmSponsorshipTx()).to.be.rejectedWith(/unique\.ConfirmUnsetSponsorFail/);
});
itSub('(!negative test!) Confirm sponsorship without sponsor being set with setCollectionSponsor', async ({helper}) => {
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const confirmSponsorshipTx = async () => collection.confirmSponsorship(charlie);
+ const confirmSponsorshipTx = () => collection.confirmSponsorship(charlie);
await expect(confirmSponsorshipTx()).to.be.rejectedWith(/unique\.ConfirmUnsetSponsorFail/);
});
itSub('(!negative test!) Confirm sponsorship in a collection that was destroyed', async ({helper}) => {
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
await collection.burn(alice);
- const confirmSponsorshipTx = async () => collection.confirmSponsorship(charlie);
+ const confirmSponsorshipTx = () => collection.confirmSponsorship(charlie);
await expect(confirmSponsorshipTx()).to.be.rejectedWith(/common\.CollectionNotFound/);
});
@@ -244,7 +244,7 @@
await collection.confirmSponsorship(bob);
const token = await collection.mintToken(alice, {Substrate: ownerZeroBalance.address});
const sponsorBalanceBefore = await helper.balance.getSubstrate(bob.address);
- const transferTx = async () => token.transfer(senderZeroBalance, {Substrate: alice.address});
+ const transferTx = () => token.transfer(senderZeroBalance, {Substrate: alice.address});
await expect(transferTx()).to.be.rejectedWith('Inability to pay some fees');
const sponsorBalanceAfter = await helper.balance.getSubstrate(bob.address);
expect(sponsorBalanceAfter).to.equal(sponsorBalanceBefore);
tests/src/createCollection.test.tsdiffbeforeafterboth--- a/tests/src/createCollection.test.ts
+++ b/tests/src/createCollection.test.ts
@@ -116,20 +116,20 @@
});
itSub('(!negative test!) create new NFT collection whith incorrect data (collection_name)', async ({helper}) => {
- const mintCollectionTx = async () => helper.nft.mintCollection(alice, {name: 'A'.repeat(65), description: 'descr', tokenPrefix: 'COL'});
+ const mintCollectionTx = () => helper.nft.mintCollection(alice, {name: 'A'.repeat(65), description: 'descr', tokenPrefix: 'COL'});
await expect(mintCollectionTx()).to.be.rejectedWith('Verification Error');
});
itSub('(!negative test!) create new NFT collection whith incorrect data (collection_description)', async ({helper}) => {
- const mintCollectionTx = async () => helper.nft.mintCollection(alice, {name: 'name', description: 'A'.repeat(257), tokenPrefix: 'COL'});
+ const mintCollectionTx = () => helper.nft.mintCollection(alice, {name: 'name', description: 'A'.repeat(257), tokenPrefix: 'COL'});
await expect(mintCollectionTx()).to.be.rejectedWith('Verification Error');
});
itSub('(!negative test!) create new NFT collection whith incorrect data (token_prefix)', async ({helper}) => {
- const mintCollectionTx = async () => helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'A'.repeat(17)});
+ const mintCollectionTx = () => helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'A'.repeat(17)});
await expect(mintCollectionTx()).to.be.rejectedWith('Verification Error');
});
itSub('(!negative test!) fails when bad limits are set', async ({helper}) => {
- const mintCollectionTx = async () => helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL', limits: {tokenLimit: 0}});
+ const mintCollectionTx = () => helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL', limits: {tokenLimit: 0}});
await expect(mintCollectionTx()).to.be.rejectedWith(/common\.CollectionTokenLimitExceeded/);
});
@@ -139,7 +139,7 @@
for (let i = 0; i < 65; i++) {
props.push({key: `key${i}`, value: `value${i}`});
}
- const mintCollectionTx = async () => helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL', properties: props});
+ const mintCollectionTx = () => helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL', properties: props});
await expect(mintCollectionTx()).to.be.rejectedWith('Verification Error');
});
@@ -150,7 +150,7 @@
props.push({key: `key${i}`.repeat(80), value: `value${i}`.repeat(80)});
}
- const mintCollectionTx = async () => helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL', properties: props});
+ const mintCollectionTx = () => helper.nft.mintCollection(alice, {name: 'name', description: 'descr', tokenPrefix: 'COL', properties: props});
await expect(mintCollectionTx()).to.be.rejectedWith('Verification Error');
});
});
tests/src/createItem.test.tsdiffbeforeafterboth--- a/tests/src/createItem.test.ts
+++ b/tests/src/createItem.test.ts
@@ -186,17 +186,17 @@
itSub('Regular user cannot create new item in NFT collection', async ({helper}) => {
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const mintTx = async () => collection.mintToken(bob, {Substrate: bob.address});
+ const mintTx = () => collection.mintToken(bob, {Substrate: bob.address});
await expect(mintTx()).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);
});
itSub('Regular user cannot create new item in Fungible collection', async ({helper}) => {
const collection = await helper.ft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'}, 0);
- const mintTx = async () => collection.mint(bob, 10n, {Substrate: bob.address});
+ const mintTx = () => collection.mint(bob, 10n, {Substrate: bob.address});
await expect(mintTx()).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);
});
itSub.ifWithPallets('Regular user cannot create new item in ReFungible collection', [Pallets.ReFungible], async ({helper}) => {
const collection = await helper.rft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const mintTx = async () => collection.mintToken(bob, 100n, {Substrate: bob.address});
+ const mintTx = () => collection.mintToken(bob, 100n, {Substrate: bob.address});
await expect(mintTx()).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);
});
@@ -204,7 +204,7 @@
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL',
tokenPropertyPermissions: [{key: 'k', permission: {mutable: false, collectionAdmin: false, tokenOwner: false}}],
});
- const mintTx = async () => collection.mintToken(alice, {Substrate: bob.address}, [{key: 'k', value: 'v'}]);
+ const mintTx = () => collection.mintToken(alice, {Substrate: bob.address}, [{key: 'k', value: 'v'}]);
await expect(mintTx()).to.be.rejectedWith(/common\.NoPermission/);
});
@@ -212,13 +212,13 @@
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL',
tokenPropertyPermissions: [{key: 'k', permission: {mutable: true, collectionAdmin: false, tokenOwner: false}}],
});
- const mintTx = async () => collection.mintToken(alice, {Substrate: bob.address}, [{key: 'k', value: 'v'}]);
+ const mintTx = () => collection.mintToken(alice, {Substrate: bob.address}, [{key: 'k', value: 'v'}]);
await expect(mintTx()).to.be.rejectedWith(/common\.NoPermission/);
});
itSub('Adding property without access rights', async ({helper}) => {
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const mintTx = async () => collection.mintToken(alice, {Substrate: bob.address}, [{key: 'k', value: 'v'}]);
+ const mintTx = () => collection.mintToken(alice, {Substrate: bob.address}, [{key: 'k', value: 'v'}]);
await expect(mintTx()).to.be.rejectedWith(/common\.NoPermission/);
});
@@ -231,7 +231,7 @@
const collection = await helper.nft.mintCollection(alice, {name: 'col', description: 'descr', tokenPrefix: 'COL'});
- const mintTx = async () => collection.mintToken(alice, {Substrate: bob.address}, props);
+ const mintTx = () => collection.mintToken(alice, {Substrate: bob.address}, props);
await expect(mintTx()).to.be.rejectedWith('Verification Error');
});
@@ -242,7 +242,7 @@
{key: 'k2', permission: {mutable: true, collectionAdmin: true, tokenOwner: true}},
],
});
- const mintTx = async () => collection.mintToken(alice, {Substrate: bob.address}, [
+ const mintTx = () => collection.mintToken(alice, {Substrate: bob.address}, [
{key: 'k1', value: 'vvvvvv'.repeat(5000)},
{key: 'k2', value: 'vvv'.repeat(5000)},
]);
tests/src/createMultipleItems.test.tsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617import {IKeyringPair} from '@polkadot/types/types';18import {usingPlaygrounds, expect, Pallets, itSub} from './util';1920describe('Integration Test createMultipleItems(collection_id, owner, items_data):', () => {21 let alice: IKeyringPair;2223 before(async () => {24 await usingPlaygrounds(async (helper, privateKey) => {25 const donor = await privateKey({filename: __filename});26 [alice] = await helper.arrange.createAccounts([100n], donor);27 });28 });2930 itSub('Create 0x31, 0x32, 0x33 items in active NFT collection and verify tokens data in chain', async ({helper}) => {31 const collection = await helper.nft.mintCollection(alice, {32 name: 'name',33 description: 'descr',34 tokenPrefix: 'COL',35 tokenPropertyPermissions: [36 {key: 'data', permission: {tokenOwner: true, mutable: false, collectionAdmin: false}},37 ],38 });39 const args = [40 {properties: [{key: 'data', value: '1'}]},41 {properties: [{key: 'data', value: '2'}]},42 {properties: [{key: 'data', value: '3'}]},43 ];44 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);45 for (const [i, token] of tokens.entries()) {46 const tokenData = await token.getData();47 expect(tokenData?.normalizedOwner.Substrate).to.be.deep.equal(helper.address.normalizeSubstrate(alice.address));48 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);49 }50 });5152 itSub('Create 0x01, 0x02, 0x03 items in active Fungible collection and verify tokens data in chain', async ({helper}) => {53 const collection = await helper.ft.mintCollection(alice, {54 name: 'name',55 description: 'descr',56 tokenPrefix: 'COL',57 });58 const args = [59 {value: 1n},60 {value: 2n},61 {value: 3n},62 ];63 await helper.ft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, args, {Substrate: alice.address});64 expect(await collection.getBalance({Substrate: alice.address})).to.be.equal(6n);65 });6667 itSub.ifWithPallets('Create 0x31, 0x32, 0x33 items in active ReFungible collection and verify tokens data in chain', [Pallets.ReFungible], async ({helper}) => {68 const collection = await helper.rft.mintCollection(alice, {69 name: 'name',70 description: 'descr',71 tokenPrefix: 'COL',72 });73 const args = [74 {pieces: 1n},75 {pieces: 2n},76 {pieces: 3n},77 ];78 const tokens = await helper.rft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);7980 for (const [i, token] of tokens.entries()) {81 expect(await token.getBalance({Substrate: alice.address})).to.be.equal(BigInt(i + 1));82 }83 });8485 itSub('Can mint amount of items equals to collection limits', async ({helper}) => {86 const collection = await helper.nft.mintCollection(alice, {87 name: 'name',88 description: 'descr',89 tokenPrefix: 'COL',90 limits: {91 tokenLimit: 2,92 },93 });94 const args = [{}, {}];95 await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);96 });9798 itSub('Create 0x31, 0x32, 0x33 items in active NFT with property Admin', async ({helper}) => {99 const collection = await helper.nft.mintCollection(alice, {100 name: 'name',101 description: 'descr',102 tokenPrefix: 'COL',103 tokenPropertyPermissions: [104 {key: 'data', permission: {tokenOwner: false, mutable: true, collectionAdmin: true}},105 ],106 });107 const args = [108 {properties: [{key: 'data', value: '1'}]},109 {properties: [{key: 'data', value: '2'}]},110 {properties: [{key: 'data', value: '3'}]},111 ];112 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);113 for (const [i, token] of tokens.entries()) {114 const tokenData = await token.getData();115 expect(tokenData?.normalizedOwner.Substrate).to.be.deep.equal(helper.address.normalizeSubstrate(alice.address));116 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);117 }118 });119120 itSub('Create 0x31, 0x32, 0x33 items in active NFT with property AdminConst', async ({helper}) => {121 const collection = await helper.nft.mintCollection(alice, {122 name: 'name',123 description: 'descr',124 tokenPrefix: 'COL',125 tokenPropertyPermissions: [126 {key: 'data', permission: {tokenOwner: false, mutable: false, collectionAdmin: true}},127 ],128 });129 const args = [130 {properties: [{key: 'data', value: '1'}]},131 {properties: [{key: 'data', value: '2'}]},132 {properties: [{key: 'data', value: '3'}]},133 ];134 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);135 for (const [i, token] of tokens.entries()) {136 const tokenData = await token.getData();137 expect(tokenData?.normalizedOwner.Substrate).to.be.deep.equal(helper.address.normalizeSubstrate(alice.address));138 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);139 }140 });141142 itSub('Create 0x31, 0x32, 0x33 items in active NFT with property itemOwnerOrAdmin', async ({helper}) => {143 const collection = await helper.nft.mintCollection(alice, {144 name: 'name',145 description: 'descr',146 tokenPrefix: 'COL',147 tokenPropertyPermissions: [148 {key: 'data', permission: {tokenOwner: true, mutable: true, collectionAdmin: true}},149 ],150 });151 const args = [152 {properties: [{key: 'data', value: '1'}]},153 {properties: [{key: 'data', value: '2'}]},154 {properties: [{key: 'data', value: '3'}]},155 ];156 const tokens = await helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);157 for (const [i, token] of tokens.entries()) {158 const tokenData = await token.getData();159 expect(tokenData?.normalizedOwner.Substrate).to.be.equal(helper.address.normalizeSubstrate(alice.address));160 expect(tokenData?.properties[0].value).to.be.equal(args[i].properties[0].value);161 }162 });163});164165describe('Negative Integration Test createMultipleItems(collection_id, owner, items_data):', () => {166 let alice: IKeyringPair;167 let bob: IKeyringPair;168169 before(async () => {170 await usingPlaygrounds(async (helper, privateKey) => {171 const donor = await privateKey({filename: __filename});172 [alice, bob] = await helper.arrange.createAccounts([100n, 100n], donor);173 });174 });175176 itSub('Regular user cannot create items in active NFT collection', async ({helper}) => {177 const collection = await helper.nft.mintCollection(alice, {178 name: 'name',179 description: 'descr',180 tokenPrefix: 'COL',181 });182 const args = [183 {},184 {},185 ];186 const mintTx = () => helper.nft.mintMultipleTokensWithOneOwner(bob, collection.collectionId, {Substrate: alice.address}, args);187 await expect(mintTx()).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);188 });189190 itSub('Regular user cannot create items in active Fungible collection', async ({helper}) => {191 const collection = await helper.ft.mintCollection(alice, {192 name: 'name',193 description: 'descr',194 tokenPrefix: 'COL',195 });196 const args = [197 {value: 1n},198 {value: 2n},199 {value: 3n},200 ];201 const mintTx = () => helper.ft.mintMultipleTokensWithOneOwner(bob, collection.collectionId, args, {Substrate: alice.address});202 await expect(mintTx()).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);203 });204205 itSub.ifWithPallets('Regular user cannot create items in active ReFungible collection', [Pallets.ReFungible], async ({helper}) => {206 const collection = await helper.rft.mintCollection(alice, {207 name: 'name',208 description: 'descr',209 tokenPrefix: 'COL',210 });211 const args = [212 {pieces: 1n},213 {pieces: 1n},214 {pieces: 1n},215 ];216 const mintTx = () => helper.rft.mintMultipleTokensWithOneOwner(bob, collection.collectionId, {Substrate: alice.address}, args);217 await expect(mintTx()).to.be.rejectedWith(/common\.PublicMintingNotAllowed/);218 });219220 itSub('Create token in not existing collection', async ({helper}) => {221 const collectionId = 1_000_000;222 const args = [223 {},224 {},225 ];226 const mintTx = () => helper.nft.mintMultipleTokensWithOneOwner(bob, collectionId, {Substrate: alice.address}, args);227 await expect(mintTx()).to.be.rejectedWith(/common\.CollectionNotFound/);228 });229230 itSub('Create NFTs that has reached the maximum data limit', async ({helper}) => {231 const collection = await helper.nft.mintCollection(alice, {232 name: 'name',233 description: 'descr',234 tokenPrefix: 'COL',235 tokenPropertyPermissions: [236 {key: 'data', permission: {tokenOwner: true, mutable: true, collectionAdmin: true}},237 ],238 });239 const args = [240 {properties: [{key: 'data', value: 'A'.repeat(32769)}]},241 {properties: [{key: 'data', value: 'B'.repeat(32769)}]},242 {properties: [{key: 'data', value: 'C'.repeat(32769)}]},243 ];244 const mintTx = () => helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);245 await expect(mintTx()).to.be.rejectedWith('Verification Error');246 });247248 itSub.ifWithPallets('Create Refungible tokens that has reached the maximum data limit', [Pallets.ReFungible], async ({helper}) => {249 const collection = await helper.rft.mintCollection(alice, {250 name: 'name',251 description: 'descr',252 tokenPrefix: 'COL',253 tokenPropertyPermissions: [254 {key: 'data', permission: {tokenOwner: true, mutable: true, collectionAdmin: true}},255 ],256 });257 const args = [258 {pieces: 10n, properties: [{key: 'data', value: 'A'.repeat(32769)}]},259 {pieces: 10n, properties: [{key: 'data', value: 'B'.repeat(32769)}]},260 {pieces: 10n, properties: [{key: 'data', value: 'C'.repeat(32769)}]},261 ];262 const mintTx = () => helper.rft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);263 await expect(mintTx()).to.be.rejectedWith('Verification Error');264 });265266 itSub.ifWithPallets('Create tokens with different types', [Pallets.ReFungible], async ({helper}) => {267 const {collectionId} = await helper.nft.mintCollection(alice, {268 name: 'name',269 description: 'descr',270 tokenPrefix: 'COL',271 });272273 const types = ['NFT', 'Fungible', 'ReFungible'];274 await expect(helper.executeExtrinsic(275 alice, 276 'api.tx.unique.createMultipleItems', 277 [collectionId, {Substrate: alice.address}, types],278 )).to.be.rejectedWith(/nonfungible\.NotNonfungibleDataUsedToMintFungibleCollectionToken/);279 });280281 itSub('Create tokens with different data limits <> maximum data limit', async ({helper}) => {282 const collection = await helper.nft.mintCollection(alice, {283 name: 'name',284 description: 'descr',285 tokenPrefix: 'COL',286 tokenPropertyPermissions: [287 {key: 'data', permission: {tokenOwner: true, mutable: true, collectionAdmin: true}},288 ],289 });290 const args = [291 {properties: [{key: 'data', value: 'A'}]},292 {properties: [{key: 'data', value: 'B'.repeat(32769)}]},293 ];294 const mintTx = () => helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);295 await expect(mintTx()).to.be.rejectedWith('Verification Error');296 });297298 itSub('Fails when minting tokens exceeds collectionLimits amount', async ({helper}) => {299 const collection = await helper.nft.mintCollection(alice, {300 name: 'name',301 description: 'descr',302 tokenPrefix: 'COL',303 tokenPropertyPermissions: [304 {key: 'data', permission: {tokenOwner: true, mutable: true, collectionAdmin: true}},305 ],306 limits: {307 tokenLimit: 1,308 },309 });310 const args = [311 {},312 {},313 ];314 const mintTx = () => helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);315 await expect(mintTx()).to.be.rejectedWith(/common\.CollectionTokenLimitExceeded/);316 });317318 itSub('User doesnt have editing rights', async ({helper}) => {319 const collection = await helper.nft.mintCollection(alice, {320 name: 'name',321 description: 'descr',322 tokenPrefix: 'COL',323 tokenPropertyPermissions: [324 {key: 'data', permission: {tokenOwner: false, mutable: true, collectionAdmin: false}},325 ],326 });327 const args = [328 {properties: [{key: 'data', value: 'A'}]},329 ];330 const mintTx = () => helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);331 await expect(mintTx()).to.be.rejectedWith(/common\.NoPermission/);332 });333334 itSub('Adding property without access rights', async ({helper}) => {335 const collection = await helper.nft.mintCollection(alice, {336 name: 'name',337 description: 'descr',338 tokenPrefix: 'COL',339 properties: [340 {341 key: 'data',342 value: 'v',343 },344 ],345 });346 const args = [347 {properties: [{key: 'data', value: 'A'}]},348 ];349 const mintTx = () => helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);350 await expect(mintTx()).to.be.rejectedWith(/common\.NoPermission/);351 });352353 itSub('Adding more than 64 prps', async ({helper}) => {354 const collection = await helper.nft.mintCollection(alice, {355 name: 'name',356 description: 'descr',357 tokenPrefix: 'COL',358 });359 const prps = [];360361 for (let i = 0; i < 65; i++) {362 prps.push({key: `key${i}`, value: `value${i}`});363 }364365 const args = [366 {properties: prps},367 {properties: prps},368 {properties: prps},369 ];370371 const mintTx = () => helper.nft.mintMultipleTokensWithOneOwner(alice, collection.collectionId, {Substrate: alice.address}, args);372 await expect(mintTx()).to.be.rejectedWith('Verification Error');373 });374});tests/src/eth/base.test.tsdiffbeforeafterboth--- a/tests/src/eth/base.test.ts
+++ b/tests/src/eth/base.test.ts
@@ -69,7 +69,7 @@
});
});
-describe('ERC165 tests', async () => {
+describe('ERC165 tests', () => {
// https://eips.ethereum.org/EIPS/eip-165
let erc721MetadataCompatibleNftCollectionId: number;
tests/src/eth/nesting/nest.test.tsdiffbeforeafterboth--- a/tests/src/eth/nesting/nest.test.ts
+++ b/tests/src/eth/nesting/nest.test.ts
@@ -81,7 +81,7 @@
});
});
- describe('Negative Test: EVM Nesting', async() => {
+ describe('Negative Test: EVM Nesting', () => {
itEth('NFT: disallows to nest token if nesting is disabled', async ({helper}) => {
const owner = await helper.eth.createAccountWithBalance(donor);
tests/src/eth/util/index.tsdiffbeforeafterboth--- a/tests/src/eth/util/index.ts
+++ b/tests/src/eth/util/index.ts
@@ -58,7 +58,7 @@
}
};
-export async function itEth(name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
+export function itEth(name: string, cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
(opts.only ? it.only :
opts.skip ? it.skip : it)(name, async function() {
await usingEthPlaygrounds(async (helper, privateKey) => {
@@ -71,7 +71,7 @@
});
}
-export async function itEthIfWithPallet(name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
+export function itEthIfWithPallet(name: string, required: string[], cb: (apis: { helper: EthUniqueHelper, privateKey: (seed: string | {filename: string}) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
return itEth(name, cb, {requiredPallets: required, ...opts});
}
tests/src/eth/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/eth/util/playgrounds/unique.dev.ts
+++ b/tests/src/eth/util/playgrounds/unique.dev.ts
@@ -367,7 +367,7 @@
return this.web3;
}
- async connectWeb3(wsEndpoint: string) {
+ connectWeb3(wsEndpoint: string) {
if(this.web3 !== null) return;
this.web3Provider = new Web3.providers.WebsocketProvider(wsEndpoint);
this.web3 = new Web3(this.web3Provider);
tests/src/pallet-presence.test.tsdiffbeforeafterboth--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -83,15 +83,15 @@
});
});
- itSub('Required pallets are present', async ({helper}) => {
+ itSub('Required pallets are present', ({helper}) => {
expect(helper.fetchAllPalletNames()).to.contain.members([...requiredPallets]);
});
- itSub('Governance and consensus pallets are present', async ({helper}) => {
+ itSub('Governance and consensus pallets are present', ({helper}) => {
expect(helper.fetchAllPalletNames()).to.contain.members([...consensusPallets]);
});
- itSub('No extra pallets are included', async ({helper}) => {
+ itSub('No extra pallets are included', ({helper}) => {
expect(helper.fetchAllPalletNames().sort()).to.be.deep.equal([...requiredPallets, ...consensusPallets].sort());
});
});
tests/src/refungible.test.tsdiffbeforeafterboth--- a/tests/src/refungible.test.ts
+++ b/tests/src/refungible.test.ts
@@ -19,7 +19,7 @@
const MAX_REFUNGIBLE_PIECES = 1_000_000_000_000_000_000_000n;
-describe('integration test: Refungible functionality:', async () => {
+describe('integration test: Refungible functionality:', () => {
let donor: IKeyringPair;
let alice: IKeyringPair;
let bob: IKeyringPair;
tests/src/rmrk/addResource.seqtest.tsdiffbeforeafterboth--- a/tests/src/rmrk/addResource.seqtest.ts
+++ b/tests/src/rmrk/addResource.seqtest.ts
@@ -112,7 +112,7 @@
const resourcesInfo = [];
const resourceNum = 4;
- const checkResource = async (resource: ResourceInfo, resType: string, expectedId: number, expected: {
+ const checkResource = (resource: ResourceInfo, resType: string, expectedId: number, expected: {
src: string,
metadata: string,
license: string,
tests/src/rmrk/equipNft.seqtest.tsdiffbeforeafterboth--- a/tests/src/rmrk/equipNft.seqtest.ts
+++ b/tests/src/rmrk/equipNft.seqtest.ts
@@ -30,7 +30,7 @@
const slotId = 1;
-async function createTestCollection(api: ApiPromise): Promise<number> {
+function createTestCollection(api: ApiPromise): Promise<number> {
return createCollection(
api,
alice,
@@ -60,7 +60,7 @@
return nftChildId;
}
-async function createTestBase(api: ApiPromise): Promise<number> {
+function createTestBase(api: ApiPromise): Promise<number> {
return createBase(api, alice, 'test-base', 'DTBase', [
{
SlotPart: {
tests/src/rmrk/rmrkIsolation.seqtest.tsdiffbeforeafterboth--- a/tests/src/rmrk/rmrkIsolation.seqtest.ts
+++ b/tests/src/rmrk/rmrkIsolation.seqtest.ts
@@ -58,7 +58,7 @@
return rmrkNftId;
}
-describe('RMRK External Integration Test', async () => {
+describe('RMRK External Integration Test', () => {
before(async function() {
await usingPlaygrounds(async (_helper, privateKey) => {
alice = await privateKey('//Alice');
@@ -78,7 +78,7 @@
});
});
-describe('Negative Integration Test: External Collections, Internal Ops', async () => {
+describe('Negative Integration Test: External Collections, Internal Ops', () => {
let uniqueCollectionId: number;
let rmrkCollectionId: number;
let rmrkNftId: number;
@@ -196,7 +196,7 @@
});
});
-describe('Negative Integration Test: Internal Collections, External Ops', async () => {
+describe('Negative Integration Test: Internal Collections, External Ops', () => {
let collectionId: number;
let nftId: number;
tests/src/rmrk/util/fetch.tsdiffbeforeafterboth--- a/tests/src/rmrk/util/fetch.ts
+++ b/tests/src/rmrk/util/fetch.ts
@@ -20,7 +20,7 @@
return (await api.rpc.rmrk.lastCollectionIdx()).toNumber();
}
-export async function getCollection(api: ApiPromise, id: number): Promise<Option<Collection>> {
+export function getCollection(api: ApiPromise, id: number): Promise<Option<Collection>> {
return api.rpc.rmrk.collectionById(id);
}
@@ -36,7 +36,7 @@
.map((value) => value.toNumber());
}
-export async function getNft(api: ApiPromise, collectionId: number, nftId: number): Promise<Option<Nft>> {
+export function getNft(api: ApiPromise, collectionId: number, nftId: number): Promise<Option<Nft>> {
return api.rpc.rmrk.nftById(collectionId, nftId);
}
@@ -56,7 +56,7 @@
return (await api.rpc.rmrk.nftChildren(collectionId, nftId)).toArray();
}
-export async function getBase(api: ApiPromise, baseId: number): Promise<Option<Base>> {
+export function getBase(api: ApiPromise, baseId: number): Promise<Option<Base>> {
return api.rpc.rmrk.base(baseId);
}
@@ -112,7 +112,7 @@
.map((name) => name.toUtf8());
}
-export async function getTheme(
+export function getTheme(
api: ApiPromise,
baseId: number,
themeName: string,
tests/src/tx-version-presence.test.tsdiffbeforeafterboth--- a/tests/src/tx-version-presence.test.ts
+++ b/tests/src/tx-version-presence.test.ts
@@ -26,7 +26,7 @@
});
});
- itSub('Signed extension CheckTxVersion is present', async () => {
+ itSub('Signed extension CheckTxVersion is present', () => {
expect(metadata.asLatest.extrinsic.signedExtensions.map(se => se.identifier.toString())).to.include('CheckTxVersion');
});
});
tests/src/util/globalSetup.tsdiffbeforeafterboth--- a/tests/src/util/globalSetup.ts
+++ b/tests/src/util/globalSetup.ts
@@ -90,7 +90,7 @@
});
};
-const fundFilenamesWithRetries = async (retriesLeft: number): Promise<boolean> => {
+const fundFilenamesWithRetries = (retriesLeft: number): Promise<boolean> => {
if (retriesLeft <= 0) return Promise.resolve(false);
return fundFilenames()
.then(() => Promise.resolve(true))
tests/src/util/index.tsdiffbeforeafterboth--- a/tests/src/util/index.ts
+++ b/tests/src/util/index.ts
@@ -59,27 +59,27 @@
return usingPlaygroundsGeneral<DevUniqueHelper>(DevUniqueHelper, url, code);
};
-export const usingWestmintPlaygrounds = async (url: string, code: (helper: DevWestmintHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+export const usingWestmintPlaygrounds = (url: string, code: (helper: DevWestmintHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
return usingPlaygroundsGeneral<DevWestmintHelper>(DevWestmintHelper, url, code);
};
-export const usingRelayPlaygrounds = async (url: string, code: (helper: DevRelayHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+export const usingRelayPlaygrounds = (url: string, code: (helper: DevRelayHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
return usingPlaygroundsGeneral<DevRelayHelper>(DevRelayHelper, url, code);
};
-export const usingAcalaPlaygrounds = async (url: string, code: (helper: DevAcalaHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+export const usingAcalaPlaygrounds = (url: string, code: (helper: DevAcalaHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
return usingPlaygroundsGeneral<DevAcalaHelper>(DevAcalaHelper, url, code);
};
-export const usingKaruraPlaygrounds = async (url: string, code: (helper: DevKaruraHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+export const usingKaruraPlaygrounds = (url: string, code: (helper: DevKaruraHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
return usingPlaygroundsGeneral<DevKaruraHelper>(DevAcalaHelper, url, code);
};
-export const usingMoonbeamPlaygrounds = async (url: string, code: (helper: DevMoonbeamHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+export const usingMoonbeamPlaygrounds = (url: string, code: (helper: DevMoonbeamHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
return usingPlaygroundsGeneral<DevMoonbeamHelper>(DevMoonbeamHelper, url, code);
};
-export const usingMoonriverPlaygrounds = async (url: string, code: (helper: DevMoonbeamHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
+export const usingMoonriverPlaygrounds = (url: string, code: (helper: DevMoonbeamHelper, privateKey: (seed: string) => Promise<IKeyringPair>) => Promise<void>) => {
return usingPlaygroundsGeneral<DevMoonriverHelper>(DevMoonriverHelper, url, code);
};
@@ -107,7 +107,7 @@
}
}
-export async function itSub(name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
+export function itSub(name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
(opts.only ? it.only :
opts.skip ? it.skip : it)(name, async function () {
await usingPlaygrounds(async (helper, privateKey) => {
@@ -119,7 +119,7 @@
});
});
}
-export async function itSubIfWithPallet(name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
+export function itSubIfWithPallet(name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any, opts: { only?: boolean, skip?: boolean, requiredPallets?: string[] } = {}) {
return itSub(name, cb, {requiredPallets: required, ...opts});
}
itSub.only = (name: string, cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSub(name, cb, {only: true});
@@ -129,7 +129,7 @@
itSubIfWithPallet.skip = (name: string, required: string[], cb: (apis: { helper: DevUniqueHelper, privateKey: (seed: string) => Promise<IKeyringPair> }) => any) => itSubIfWithPallet(name, required, cb, {skip: true});
itSub.ifWithPallets = itSubIfWithPallet;
-export async function describeXCM(title: string, fn: (this: Mocha.Suite) => void, opts: {skip?: boolean} = {}) {
+export function describeXCM(title: string, fn: (this: Mocha.Suite) => void, opts: {skip?: boolean} = {}) {
(process.env.RUN_XCM_TESTS && !opts.skip
? describe
: describe.skip)(title, fn);
tests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.dev.ts
+++ b/tests/src/util/playgrounds/unique.dev.ts
@@ -267,7 +267,7 @@
}
const block2 = await this.helper.callRpc('api.rpc.chain.getBlock', [await this.helper.callRpc('api.rpc.chain.getBlockHash', [blockNumber])]);
const block1 = await this.helper.callRpc('api.rpc.chain.getBlock', [await this.helper.callRpc('api.rpc.chain.getBlockHash', [blockNumber - 1])]);
- const findCreationDate = async (block: any) => {
+ const findCreationDate = (block: any) => {
const humanBlock = block.toHuman();
let date;
humanBlock.block.extrinsics.forEach((ext: any) => {
@@ -349,7 +349,7 @@
* @param blocksCount number of blocks to wait
* @returns
*/
- async newBlocks(blocksCount = 1): Promise<void> {
+ newBlocks(blocksCount = 1): Promise<void> {
// eslint-disable-next-line no-async-promise-executor
const promise = new Promise<void>(async (resolve) => {
const unsubscribe = await this.helper.getApi().rpc.chain.subscribeNewHeads(() => {
@@ -364,10 +364,10 @@
return promise;
}
- async forParachainBlockNumber(blockNumber: bigint) {
+ forParachainBlockNumber(blockNumber: bigint) {
// eslint-disable-next-line no-async-promise-executor
return new Promise<void>(async (resolve) => {
- const unsubscribe = await this.helper.getApi().rpc.chain.subscribeNewHeads(async (data: any) => {
+ const unsubscribe = await this.helper.getApi().rpc.chain.subscribeNewHeads((data: any) => {
if (data.number.toNumber() >= blockNumber) {
unsubscribe();
resolve();
@@ -376,10 +376,10 @@
});
}
- async forRelayBlockNumber(blockNumber: bigint) {
+ forRelayBlockNumber(blockNumber: bigint) {
// eslint-disable-next-line no-async-promise-executor
return new Promise<void>(async (resolve) => {
- const unsubscribe = await this.helper.getApi().query.parachainSystem.validationData(async (data: any) => {
+ const unsubscribe = await this.helper.getApi().query.parachainSystem.validationData((data: any) => {
if (data.value.relayParentNumber.toNumber() >= blockNumber) {
// @ts-ignore
unsubscribe();
@@ -389,7 +389,7 @@
});
}
- async event(maxBlocksToWait: number, eventSection: string, eventMethod: string) {
+ event(maxBlocksToWait: number, eventSection: string, eventMethod: string) {
// eslint-disable-next-line no-async-promise-executor
const promise = new Promise<EventRecord | null>(async (resolve) => {
const unsubscribe = await this.helper.getApi().rpc.chain.subscribeNewHeads(async header => {