difftreelog
fix cross test
in: master
1 file changed
tests/src/eth/collectionAdmin.test.tsdiffbeforeafterboth131 expect(adminList.length).to.be.eq(0);131 expect(adminList.length).to.be.eq(0);132 });132 });133133134 itEth.skip('(!negative tests!) Add substrate admin by ADMIN is not allowed', async ({helper}) => {134 itEth('(!negative tests!) Add [cross] admin by ADMIN is not allowed', async ({helper}) => {135 const owner = await helper.eth.createAccountWithBalance(donor);135 const owner = await helper.eth.createAccountWithBalance(donor);136 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');136 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');137137140 await collectionEvm.methods.addCollectionAdmin(admin).send();140 await collectionEvm.methods.addCollectionAdmin(admin).send();141141142 const [notAdmin] = await helper.arrange.createAccounts([10n], donor);142 const [notAdmin] = await helper.arrange.createAccounts([10n], donor);143 const notAdminCross = helper.ethCrossAccount.fromKeyringPair(notAdmin);143 await expect(collectionEvm.methods.addCollectionAdminSubstrate(notAdmin.addressRaw).call({from: admin}))144 await expect(collectionEvm.methods.addCollectionAdminCross(notAdminCross).call({from: admin}))144 .to.be.rejectedWith('NoPermission');145 .to.be.rejectedWith('NoPermission');145146146 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);147 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);149 .to.be.eq(admin.toLocaleLowerCase());150 .to.be.eq(admin.toLocaleLowerCase());150 });151 });151152152 itEth.skip('(!negative tests!) Add substrate admin by USER is not allowed', async ({helper}) => {153 itEth('(!negative tests!) Add [cross] admin by USER is not allowed', async ({helper}) => {153 const owner = await helper.eth.createAccountWithBalance(donor);154 const owner = await helper.eth.createAccountWithBalance(donor);154 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');155 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');155156156 const notAdmin0 = await helper.eth.createAccountWithBalance(donor);157 const notAdmin0 = await helper.eth.createAccountWithBalance(donor);157 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);158 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);158 const [notAdmin1] = await helper.arrange.createAccounts([10n], donor);159 const [notAdmin1] = await helper.arrange.createAccounts([10n], donor);160 const notAdmin1Cross = helper.ethCrossAccount.fromKeyringPair(notAdmin1);159 await expect(collectionEvm.methods.addCollectionAdminSubstrate(notAdmin1.addressRaw).call({from: notAdmin0}))161 await expect(collectionEvm.methods.addCollectionAdminCross(notAdmin1Cross).call({from: notAdmin0}))160 .to.be.rejectedWith('NoPermission');162 .to.be.rejectedWith('NoPermission');161163162 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);164 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);193 expect(adminList.length).to.be.eq(0);195 expect(adminList.length).to.be.eq(0);194 });196 });195197196 itEth.skip('Remove substrate admin by owner', async ({helper}) => {198 itEth('Remove [cross] admin by owner', async ({helper}) => {197 const owner = await helper.eth.createAccountWithBalance(donor);199 const owner = await helper.eth.createAccountWithBalance(donor);198 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');200 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');199201200 const [newAdmin] = await helper.arrange.createAccounts([10n], donor);202 const [newAdmin] = await helper.arrange.createAccounts([10n], donor);203 const newAdminCross = helper.ethCrossAccount.fromKeyringPair(newAdmin);201 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);204 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);202 await collectionEvm.methods.addCollectionAdminSubstrate(newAdmin.addressRaw).send();205 await collectionEvm.methods.addCollectionAdminCross(newAdminCross).send();203 {206 {204 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);207 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);205 expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())208 expect(adminList[0].asSubstrate.toString().toLocaleLowerCase())206 .to.be.eq(newAdmin.address.toLocaleLowerCase());209 .to.be.eq(newAdmin.address.toLocaleLowerCase());207 }210 }208211209 await collectionEvm.methods.removeCollectionAdminSubstrate(newAdmin.addressRaw).send();212 await collectionEvm.methods.removeCollectionAdminCross(newAdminCross).send();210 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);213 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);211 expect(adminList.length).to.be.eq(0);214 expect(adminList.length).to.be.eq(0);212 });215 });253 }256 }254 });257 });255258256 itEth.skip('(!negative tests!) Remove substrate admin by ADMIN is not allowed', async ({helper}) => {259 itEth('(!negative tests!) Remove [cross] admin by ADMIN is not allowed', async ({helper}) => {257 const owner = await helper.eth.createAccountWithBalance(donor);260 const owner = await helper.eth.createAccountWithBalance(donor);258 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');261 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');259262260 const [adminSub] = await helper.arrange.createAccounts([10n], donor);263 const [adminSub] = await helper.arrange.createAccounts([10n], donor);264 const adminSubCross = helper.ethCrossAccount.fromKeyringPair(adminSub);261 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);265 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);262 await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();266 await collectionEvm.methods.addCollectionAdminCross(adminSubCross).send();263 const adminEth = await helper.eth.createAccountWithBalance(donor);267 const adminEth = await helper.eth.createAccountWithBalance(donor);264 await collectionEvm.methods.addCollectionAdmin(adminEth).send();268 await collectionEvm.methods.addCollectionAdmin(adminEth).send();265269266 await expect(collectionEvm.methods.removeCollectionAdminSubstrate(adminSub.addressRaw).call({from: adminEth}))270 await expect(collectionEvm.methods.removeCollectionAdminCross(adminSubCross).call({from: adminEth}))267 .to.be.rejectedWith('NoPermission');271 .to.be.rejectedWith('NoPermission');268272269 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);273 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);273 .to.be.deep.contains(adminEth.toLocaleLowerCase());277 .to.be.deep.contains(adminEth.toLocaleLowerCase());274 });278 });275279276 itEth.skip('(!negative tests!) Remove substrate admin by USER is not allowed', async ({helper}) => {280 itEth('(!negative tests!) Remove [cross] admin by USER is not allowed', async ({helper}) => {277 const owner = await helper.eth.createAccountWithBalance(donor);281 const owner = await helper.eth.createAccountWithBalance(donor);278 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');282 const {collectionAddress, collectionId} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');279283280 const [adminSub] = await helper.arrange.createAccounts([10n], donor);284 const [adminSub] = await helper.arrange.createAccounts([10n], donor);285 const adminSubCross = helper.ethCrossAccount.fromKeyringPair(adminSub);281 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);286 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);282 await collectionEvm.methods.addCollectionAdminSubstrate(adminSub.addressRaw).send();287 await collectionEvm.methods.addCollectionAdminCross(adminSubCross).send();283 const notAdminEth = await helper.eth.createAccountWithBalance(donor);288 const notAdminEth = await helper.eth.createAccountWithBalance(donor);284289285 await expect(collectionEvm.methods.removeCollectionAdminSubstrate(adminSub.addressRaw).call({from: notAdminEth}))290 await expect(collectionEvm.methods.removeCollectionAdminCross(adminSubCross).call({from: notAdminEth}))286 .to.be.rejectedWith('NoPermission');291 .to.be.rejectedWith('NoPermission');287292288 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);293 const adminList = await helper.callRpc('api.rpc.unique.adminlist', [collectionId]);343 });348 });344 });349 });345350346 itEth.skip('Change owner', async ({helper}) => {351 itEth('Change owner [cross]', async ({helper}) => {347 const owner = await helper.eth.createAccountWithBalance(donor);352 const owner = await helper.eth.createAccountWithBalance(donor);348 const [newOwner] = await helper.arrange.createAccounts([10n], donor);353 const [newOwner] = await helper.arrange.createAccounts([10n], donor);354 const newOwnerCross = helper.ethCrossAccount.fromKeyringPair(newOwner);349 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');355 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');350 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);356 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);351357352 expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.true;358 expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.true;353 expect(await collectionEvm.methods.isOwnerOrAdminSubstrate(newOwner.addressRaw).call()).to.be.false;359 expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.false;354360355 await collectionEvm.methods.setOwnerSubstrate(newOwner.addressRaw).send();361 await collectionEvm.methods.setOwnerCross(newOwnerCross).send();356362357 expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.false;363 expect(await collectionEvm.methods.isOwnerOrAdmin(owner).call()).to.be.false;358 expect(await collectionEvm.methods.isOwnerOrAdminSubstrate(newOwner.addressRaw).call()).to.be.true;364 expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.true;359 });365 });360366361 itEth.skip('change owner call fee', async ({helper}) => {367 itEth.skip('change owner call fee', async ({helper}) => {369 expect(cost > 0);375 expect(cost > 0);370 });376 });371377372 itEth.skip('(!negative tests!) call setOwner by non owner', async ({helper}) => {378 itEth('(!negative tests!) call setOwner by non owner [cross]', async ({helper}) => {373 const owner = await helper.eth.createAccountWithBalance(donor);379 const owner = await helper.eth.createAccountWithBalance(donor);374 const otherReceiver = await helper.eth.createAccountWithBalance(donor);380 const otherReceiver = await helper.eth.createAccountWithBalance(donor);375 const [newOwner] = await helper.arrange.createAccounts([10n], donor);381 const [newOwner] = await helper.arrange.createAccounts([10n], donor);382 const newOwnerCross = helper.ethCrossAccount.fromKeyringPair(newOwner);376 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');383 const {collectionAddress} = await helper.eth.createNFTCollection(owner, 'A', 'B', 'C');377 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);384 const collectionEvm = helper.ethNativeContract.collection(collectionAddress, 'nft', owner);378385379 await expect(collectionEvm.methods.setOwnerSubstrate(newOwner.addressRaw).send({from: otherReceiver})).to.be.rejected;386 await expect(collectionEvm.methods.setOwnerCross(newOwnerCross).send({from: otherReceiver})).to.be.rejected;380 expect(await collectionEvm.methods.isOwnerOrAdminSubstrate(newOwner.addressRaw).call()).to.be.false;387 expect(await collectionEvm.methods.isOwnerOrAdminCross(newOwnerCross).call()).to.be.false;381 });388 });382});389});383390