Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactors bridge-calls.js to remove unnecessary test. #180

Open
wants to merge 1 commit into
base: remove-all-pre-test-files
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 4 additions & 27 deletions lib/tests/bridge-calls.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ const expect = chai.expect;
chai.use(require('chai-as-promised'));
const fs = require('fs');
const CustomError = require('../CustomError');
const { wait } = require('../utils');
const rskUtils = require('../rsk-utils');
const solUtils = require('../sol-utils');
const btcEthUnitConverter = require('@rsksmart/btc-eth-unit-converter');
const { getRskTransactionHelpers, getRskTransactionHelper } = require('../rsk-tx-helper-provider');

const { getRskTransactionHelper } = require('../rsk-tx-helper-provider');
const { getBridge } = require('../bridge-provider');

const INITIAL_RSK_BALANCE_IN_BTC = 1;
Expand Down Expand Up @@ -103,32 +101,11 @@ const testMethod = (bridgeCallsAllowed) => (methodSignature, args, expectedWhenF
}
});

it(`${bridgeCallsAllowed ? '' : 'no '}contract calls allowed`, async () => {
if (bridgeCallsAllowed) {
const success = await contractCallsTester.methods.doCall(abi).call();
expect(success).to.equal(bridgeCallsAllowed);
} else {
await expect(contractCallsTester.methods.doCall(abi).call()).to.be.rejected;
}
it(`contract calls allowed`, async () => {
const success = await contractCallsTester.methods.doCall(abi).call();
expect(success).to.be.true;
});

if (bridgeCallsAllowed) {
it(`txs are mined and execution is reverted`, async () => {
try {
const txPromise = contractCallsTester.methods.doCall(abi).send({
from: address
});

// TODO: Change this when instamining is enabled. txPromise should be await.
await wait(500);
await rskUtils.mineAndSync(getRskTransactionHelpers());

await expect(txPromise).to.be.rejected;
} catch (err) {
throw new CustomError('Txs are mined and execution reverted failure', err);
}
});
}
});
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const bridgeCallsTests = require('../lib/tests/bridge-calls');

bridgeCallsTests.execute('Bridge calls and txs from contracts to constant fns', () => Runners.hosts.federate.host, true);
bridgeCallsTests.execute('Bridge calls and txs from contracts to constant fns', () => Runners.hosts.federate.host);
Loading