git.delta.rocks / unique-network / refs/commits / ccf797c021e8

difftreelog

Fix admin test and remove //Alice

Max Andreev2022-12-01parent: #4a008cd.patch.diff
in: master

2 files changed

modifiedtests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth
--- a/tests/src/eth/collectionAdmin.test.ts
+++ b/tests/src/eth/collectionAdmin.test.ts
@@ -77,16 +77,21 @@
     const {collectionAddress, collectionId} = await helper.eth.createERC721MetadataCompatibleNFTCollection(owner, 'Mint collection', 'a', 'b', 'uri');
     const adminEth = (await helper.eth.createAccountWithBalance(donor)).toLowerCase();
     const adminCrossEth = helper.ethCrossAccount.fromAddress(adminEth);
+    const [adminSub] = await helper.arrange.createAccounts([100n], donor);
+    const adminCrossSub = helper.ethCrossAccount.fromKeyringPair(adminSub);
     const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner, true);
     
     // cannot mint while not admin
-    await expect(collectionEvm.methods.mint(owner).send({from: adminEth})).to.be.rejectedWith('PublicMintingNotAllowed');
+    await expect(collectionEvm.methods.mint(owner).send({from: adminEth})).to.be.rejected;
+    await expect(helper.nft.mintToken(adminSub, {collectionId, owner: {Ethereum: owner}})).to.be.rejectedWith(/common.PublicMintingNotAllowed/);
     
-    // admin can mint token:
+    // admin (sub and eth) can mint token:
     await collectionEvm.methods.addCollectionAdminCross(adminCrossEth).send();
+    await collectionEvm.methods.addCollectionAdminCross(adminCrossSub).send();
     await collectionEvm.methods.mint(owner).send({from: adminEth});
+    await helper.nft.mintToken(adminSub, {collectionId, owner: {Ethereum: owner}});
 
-    expect(await helper.collection.getLastTokenId(collectionId)).to.eq(1);
+    expect(await helper.collection.getLastTokenId(collectionId)).to.eq(2);
   });
 
   itEth('cannot add invalid cross account admin', async ({helper}) => {
modifiedtests/src/eth/nonFungible.test.tsdiffbeforeafterboth
360 }360 }
361 });361 });
362362
363 itEth('Can perform transferFromCross()', async ({helper, privateKey}) => {363 itEth('Can perform transferFromCross()', async ({helper}) => {
364 const minter = await privateKey('//Alice');
365 const collection = await helper.nft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});364 const collection = await helper.nft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'});
366365
367 const owner = await privateKey('//Bob');366 const [owner, receiver] = await helper.arrange.createAccounts([100n, 100n], donor);
368 const spender = await helper.eth.createAccountWithBalance(donor);367 const spender = await helper.eth.createAccountWithBalance(donor);
369 const receiver = await privateKey('//Charlie');
370368
371 const token = await collection.mintToken(minter, {Substrate: owner.address});369 const token = await collection.mintToken(minter, {Substrate: owner.address});
372370