--- a/tests/src/addCollectionAdmin.test.ts +++ b/tests/src/addCollectionAdmin.test.ts @@ -56,10 +56,8 @@ const collection = await helper.collection.getData(collectionId); expect(collection?.normalizedOwner).to.be.equal(helper.address.normalizeSubstrate(alice.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/); + await expect(helper.collection.addAdmin(bob, collectionId, {Substrate: charlie.address})).to.be.rejectedWith(/common\.NoPermission/); + await expect(helper.collection.addAdmin(bob, collectionId, {Substrate: bob.address})).to.be.rejectedWith(/common\.NoPermission/); const adminListAfterAddAdmin = await helper.collection.getAdmins(collectionId); expect(adminListAfterAddAdmin).to.be.not.deep.contains({Substrate: charlie.address}); @@ -75,8 +73,7 @@ const adminListAfterAddAdmin = await collection.getAdmins(); expect(adminListAfterAddAdmin).to.be.deep.contains({Substrate: bob.address}); - const changeAdminTxCharlie = () => collection.addAdmin(bob, {Substrate: charlie.address}); - await expect(changeAdminTxCharlie()).to.be.rejectedWith(/common\.NoPermission/); + await expect(collection.addAdmin(bob, {Substrate: charlie.address})).to.be.rejectedWith(/common\.NoPermission/); const adminListAfterAddNewAdmin = await collection.getAdmins(); expect(adminListAfterAddNewAdmin).to.be.deep.contains({Substrate: bob.address}); @@ -87,8 +84,7 @@ const [alice, bob] = await helper.arrange.createAccounts([10n, 10n, 10n], donor); const collectionId = (1 << 32) - 1; - const addAdminTx = () => helper.collection.addAdmin(alice, collectionId, {Substrate: bob.address}); - await expect(addAdminTx()).to.be.rejectedWith(/common\.CollectionNotFound/); + await expect(helper.collection.addAdmin(alice, collectionId, {Substrate: bob.address})).to.be.rejectedWith(/common\.CollectionNotFound/); // Verifying that nothing bad happened (network is live, new collections can be created, etc.) await helper.nft.mintCollection(alice, {name: 'Collection Name', description: 'Collection Description', tokenPrefix: 'COL'}); @@ -99,8 +95,7 @@ const collection = await helper.nft.mintCollection(alice, {name: 'Collection Name', description: 'Collection Description', tokenPrefix: 'COL'}); await collection.burn(alice); - const addAdminTx = () => collection.addAdmin(alice, {Substrate: bob.address}); - await expect(addAdminTx()).to.be.rejectedWith(/common\.CollectionNotFound/); + await expect(collection.addAdmin(alice, {Substrate: bob.address})).to.be.rejectedWith(/common\.CollectionNotFound/); // Verifying that nothing bad happened (network is live, new collections can be created, etc.) await helper.nft.mintCollection(alice, {name: 'Collection Name', description: 'Collection Description', tokenPrefix: 'COL'}); @@ -119,7 +114,6 @@ expect(adminListAfterAddAdmin).to.be.deep.contains({Substrate: accounts[i].address}); } - const addExtraAdminTx = () => collection.addAdmin(alice, {Substrate: accounts[chainAdminLimit].address}); - await expect(addExtraAdminTx()).to.be.rejectedWith(/common\.CollectionAdminCountExceeded/); + await expect(collection.addAdmin(alice, {Substrate: accounts[chainAdminLimit].address})).to.be.rejectedWith(/common\.CollectionAdminCountExceeded/); }); }); --- a/tests/src/adminTransferAndBurn.test.ts +++ b/tests/src/adminTransferAndBurn.test.ts @@ -36,8 +36,7 @@ expect(limits.ownerCanTransfer).to.be.true; const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address}); - const transferResult = () => helper.nft.transferToken(alice, collectionId, tokenId, {Substrate: charlie.address}); - await expect(transferResult()).to.be.rejected; + await expect(helper.nft.transferToken(alice, collectionId, tokenId, {Substrate: charlie.address})).to.be.rejected; await helper.nft.transferTokenFrom(alice, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address}); const newTokenOwner = await helper.nft.getTokenOwner(collectionId, tokenId); @@ -52,9 +51,8 @@ expect(limits.ownerCanTransfer).to.be.true; const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address}); - const burnTxFailed = () => helper.nft.burnToken(alice, collectionId, tokenId); - await expect(burnTxFailed()).to.be.rejected; + await expect(helper.nft.burnToken(alice, collectionId, tokenId)).to.be.rejected; await helper.nft.burnToken(bob, collectionId, tokenId); const token = await helper.nft.getToken(collectionId, tokenId);