difftreelog
fix maintenance tests
in: master
1 file changed
tests/src/maintenanceMode.seqtest.tsdiffbeforeafterboth434344 itSub('Allows superuser to enable and disable maintenance mode - and disallows anyone else', async ({helper}) => {44 itSub('Allows superuser to enable and disable maintenance mode - and disallows anyone else', async ({helper}) => {45 // Make sure non-sudo can't enable maintenance mode45 // Make sure non-sudo can't enable maintenance mode46 await expect(helper.executeExtrinsic(superuser, 'api.tx.maintenance.enable', []), 'on commoner enabling MM').to.be.rejected; //With(/NoPermission/);46 await expect(helper.executeExtrinsic(superuser, 'api.tx.maintenance.enable', []), 'on commoner enabling MM')47 .to.be.rejectedWith(/BadOrigin/);474848 // Set maintenance mode49 // Set maintenance mode49 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);50 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.enable', []);50 expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;51 expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;515252 // Make sure non-sudo can't disable maintenance mode53 // Make sure non-sudo can't disable maintenance mode53 await expect(helper.executeExtrinsic(bob, 'api.tx.maintenance.disable', []), 'on commoner disabling MM').to.be.rejected; //With(/NoPermission/);54 await expect(helper.executeExtrinsic(bob, 'api.tx.maintenance.disable', []), 'on commoner disabling MM')55 .to.be.rejectedWith(/BadOrigin/);545655 // Disable maintenance mode57 // Disable maintenance mode56 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);58 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);80 expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;82 expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;818382 // Unable to create a collection when the MM is enabled84 // Unable to create a collection when the MM is enabled83 await expect(helper.nft.mintCollection(superuser), 'cudo forbidden stuff').to.be.rejected;85 await expect(helper.nft.mintCollection(superuser), 'cudo forbidden stuff')86 .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);848785 // Unable to set token properties when the MM is enabled88 // Unable to set token properties when the MM is enabled86 await expect(nft.setProperties(89 await expect(nft.setProperties(87 bob,90 bob,88 [{key: 'test', value: 'test-val'}],91 [{key: 'test', value: 'test-val'}],89 )).to.be.rejected;92 )).to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);909391 // Unable to mint an NFT when the MM is enabled94 // Unable to mint an NFT when the MM is enabled92 await expect(nftCollection.mintToken(superuser)).to.be.rejected;95 await expect(nftCollection.mintToken(superuser))96 .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);939794 // Unable to mint an FT when the MM is enabled98 // Unable to mint an FT when the MM is enabled95 await expect(ftCollection.mint(superuser)).to.be.rejected;99 await expect(ftCollection.mint(superuser))100 .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);9610197 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);102 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);98 expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;103 expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;121 expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;126 expect(await maintenanceEnabled(helper.getApi()), 'MM is OFF when it should be ON').to.be.true;122127123 // Unable to mint an RFT when the MM is enabled128 // Unable to mint an RFT when the MM is enabled124 await expect(rftCollection.mintToken(superuser)).to.be.rejected;129 await expect(rftCollection.mintToken(superuser))125 130 .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);131 126 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);132 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);127 expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;133 expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;195201196 // Any attempts to schedule a tx during the MM should be rejected202 // Any attempts to schedule a tx during the MM should be rejected197 await expect(nftDuringMM.scheduleAfter(scheduledIdAttemptDuringMM, blocksToWait)203 await expect(nftDuringMM.scheduleAfter(scheduledIdAttemptDuringMM, blocksToWait)198 .transfer(bob, {Substrate: superuser.address})).to.be.rejected;204 .transfer(bob, {Substrate: superuser.address}))205 .to.be.rejectedWith(/Invalid Transaction: Transaction call is not expected/);199206200 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);207 await helper.getSudo().executeExtrinsic(superuser, 'api.tx.maintenance.disable', []);201 expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;208 expect(await maintenanceEnabled(helper.getApi()), 'MM is ON when it should be OFF').to.be.false;225 const tokenId = await contract.methods.nextTokenId().call();232 const tokenId = await contract.methods.nextTokenId().call();226 expect(tokenId).to.be.equal('1');233 expect(tokenId).to.be.equal('1');227234228 /*const result = */229 await contract.methods.mintWithTokenURI(235 await expect(contract.methods.mintWithTokenURI(receiver, 'Test URI').send())230 receiver,231 'Test URI',232 ).send();236 .to.be.rejectedWith(/submit transaction to pool failed: Pool\(InvalidTransaction\(InvalidTransaction::Call\)\)/);233 /*const expectedTokenId = result.events.Transfer.returnValues.tokenId;234 expect(expectedTokenId).to.be.equal(tokenId);*/235237236 await expect(contract.methods.ownerOf(tokenId).call()).rejectedWith(/token not found/);238 await expect(contract.methods.ownerOf(tokenId).call()).rejectedWith(/token not found/);237239