difftreelog
Combine transactions and expects
in: master
2 files changed
tests/src/addCollectionAdmin.test.tsdiffbeforeafterboth--- 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/);
});
});
tests/src/adminTransferAndBurn.test.tsdiffbeforeafterboth36 expect(limits.ownerCanTransfer).to.be.true;36 expect(limits.ownerCanTransfer).to.be.true;373738 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});38 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});39 const transferResult = () => helper.nft.transferToken(alice, collectionId, tokenId, {Substrate: charlie.address});39 await expect(helper.nft.transferToken(alice, collectionId, tokenId, {Substrate: charlie.address})).to.be.rejected;40 await expect(transferResult()).to.be.rejected;414042 await helper.nft.transferTokenFrom(alice, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address});41 await helper.nft.transferTokenFrom(alice, collectionId, tokenId, {Substrate: bob.address}, {Substrate: charlie.address});43 const newTokenOwner = await helper.nft.getTokenOwner(collectionId, tokenId);42 const newTokenOwner = await helper.nft.getTokenOwner(collectionId, tokenId);535254 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});53 const {tokenId} = await helper.nft.mintToken(alice, {collectionId: collectionId, owner: bob.address});5455 const burnTxFailed = () => helper.nft.burnToken(alice, collectionId, tokenId);55 await expect(helper.nft.burnToken(alice, collectionId, tokenId)).to.be.rejected;5657 await expect(burnTxFailed()).to.be.rejected;585659 await helper.nft.burnToken(bob, collectionId, tokenId);57 await helper.nft.burnToken(bob, collectionId, tokenId);60 const token = await helper.nft.getToken(collectionId, tokenId);58 const token = await helper.nft.getToken(collectionId, tokenId);