--- a/tests/src/eth/allowlist.test.ts +++ b/tests/src/eth/allowlist.test.ts @@ -106,28 +106,33 @@ expect(await helper.collection.allowed(collectionId, {Substrate: userSub.address})).to.be.false; await collectionEvm.methods.addToCollectionAllowListCross(userCrossSub).send({from: owner}); await collectionEvm.methods.addToCollectionAllowListCross(userCrossEth).send({from: owner}); + await collectionEvm.methods.addToCollectionAllowListCross(ownerCrossEth).send({from: owner}); expect(await helper.collection.allowed(collectionId, {Substrate: userSub.address})).to.be.true; expect(await helper.collection.allowed(collectionId, {Ethereum: userEth})).to.be.true; expect(await collectionEvm.methods.allowlistedCross(userCrossSub).call({from: owner})).to.be.true; expect(await collectionEvm.methods.allowlistedCross(userCrossEth).call({from: owner})).to.be.true; - // allowlisted account can transfer tokens: - await collectionEvm.methods.mint(userEth).send(); + await collectionEvm.methods.mint(userEth).send(); // token #1 + await collectionEvm.methods.mint(userEth).send(); // token #2 await collectionEvm.methods.setCollectionAccess(1).send(); - await collectionEvm.methods.transfer(owner, 1).send({from: userEth}); // FIXME: why not? - // await collectionEvm.methods.transferCross(ownerCrossEth, 1).send({from: userEth}); // FIXME: why not? - expect(await helper.nft.getTokenOwner(collectionId, 1)).to.eq({Ethereum: owner}); - // can removeFromCollectionAllowListCross + // allowlisted account can transfer and transferCross: + await collectionEvm.methods.transfer(owner, 1).send({from: userEth}); + await collectionEvm.methods.transferCross(userCrossSub, 2).send({from: userEth}); + expect(await helper.nft.getTokenOwner(collectionId, 1)).to.deep.eq({Ethereum: owner}); + expect(await helper.nft.getTokenOwner(collectionId, 2)).to.deep.eq({Substrate: userSub.address}); + + // can removeFromCollectionAllowListCross: await collectionEvm.methods.removeFromCollectionAllowListCross(userCrossSub).send({from: owner}); await collectionEvm.methods.removeFromCollectionAllowListCross(userCrossEth).send({from: owner}); expect(await helper.collection.allowed(collectionId, {Substrate: userSub.address})).to.be.false; - expect(await helper.collection.allowed(collectionId, {Substrate: userEth})).to.be.false; + expect(await helper.collection.allowed(collectionId, {Ethereum: userEth})).to.be.false; + expect(await collectionEvm.methods.allowlistedCross(userCrossSub).call({from: owner})).to.be.false; expect(await collectionEvm.methods.allowlistedCross(userCrossEth).call({from: owner})).to.be.false; // cannot transfer anymore await collectionEvm.methods.mint(userEth).send(); - await expect(collectionEvm.methods.transfer(owner, 2).send({from: userEth})).to.be.rejected; + await expect(collectionEvm.methods.transfer(owner, 2).send({from: userEth})).to.be.rejectedWith(/Transaction has been reverted/); }); // Soft-deprecated