From ccf797c021e81eab14bf8f6495458abd851ec599 Mon Sep 17 00:00:00 2001 From: Max Andreev Date: Thu, 01 Dec 2022 10:56:04 +0000 Subject: [PATCH] Fix admin test and remove //Alice --- --- 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}) => { --- a/tests/src/eth/nonFungible.test.ts +++ b/tests/src/eth/nonFungible.test.ts @@ -360,13 +360,11 @@ } }); - itEth('Can perform transferFromCross()', async ({helper, privateKey}) => { - const minter = await privateKey('//Alice'); + itEth('Can perform transferFromCross()', async ({helper}) => { const collection = await helper.nft.mintCollection(minter, {name: 'A', description: 'B', tokenPrefix: 'C'}); - const owner = await privateKey('//Bob'); + const [owner, receiver] = await helper.arrange.createAccounts([100n, 100n], donor); const spender = await helper.eth.createAccountWithBalance(donor); - const receiver = await privateKey('//Charlie'); const token = await collection.mintToken(minter, {Substrate: owner.address}); -- gitstuff