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

difftreelog

Merge pull request #292 from UniqueNetwork/test/fix-sponsoring-tests

kozyrevdev2022-02-18parents: #f663e99 #1703581.patch.diff
in: master
Fix sponsoring tests

2 files changed

modifiedtests/src/eth/allowlist.test.tsdiffbeforeafterboth
--- a/tests/src/eth/allowlist.test.ts
+++ b/tests/src/eth/allowlist.test.ts
@@ -1,27 +1,23 @@
 import {expect} from 'chai';
-import {contractHelpers, createEthAccount, createEthAccountWithBalance, deployFlipper, itWeb3} from './util/helpers';
+import {contractHelpers, createEthAccountWithBalance, deployFlipper, itWeb3} from './util/helpers';
 
 describe('EVM allowlist', () => {
   itWeb3('Contract allowlist can be toggled', async ({api, web3}) => {
     const owner = await createEthAccountWithBalance(api, web3);
     const flipper = await deployFlipper(web3, owner);
-    const randomUser = createEthAccount(web3);
 
     const helpers = contractHelpers(web3, owner);
 
     // Any user is allowed by default
     expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;
-    expect(await helpers.methods.allowed(flipper.options.address, randomUser).call()).to.be.true;
 
     // Enable
     await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});
     expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.true;
-    expect(await helpers.methods.allowed(flipper.options.address, randomUser).call()).to.be.false;
 
     // Disable
     await helpers.methods.toggleAllowlist(flipper.options.address, false).send({from: owner});
     expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;
-    expect(await helpers.methods.allowed(flipper.options.address, randomUser).call()).to.be.true;
   });
 
   itWeb3('Non-allowlisted user can\'t call contract with allowlist enabled', async ({api, web3}) => {
modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
113 const originalFlipperBalance = await web3.eth.getBalance(flipper.options.address);113 const originalFlipperBalance = await web3.eth.getBalance(flipper.options.address);
114 expect(originalFlipperBalance).to.be.not.equal('0');114 expect(originalFlipperBalance).to.be.not.equal('0');
115115
116 await flipper.methods.flip().send({from: caller});116 await expect(flipper.methods.flip().send({from: caller})).to.be.rejectedWith(/InvalidTransaction::Payment/);
117 expect(await flipper.methods.getValue().call()).to.be.true;117 expect(await flipper.methods.getValue().call()).to.be.false;
118118
119 // Balance should be taken from flipper instead of caller119 // Balance should be taken from flipper instead of caller
120 const balanceAfter = await web3.eth.getBalance(flipper.options.address);120 const balanceAfter = await web3.eth.getBalance(flipper.options.address);