Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juanenrisley committed Aug 22, 2023
1 parent 7fba17f commit c3a7139
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 228 deletions.
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
},
modulePathIgnorePatterns: ['<rootDir>/test/helpers'],
testEnvironment: 'node',
testMatch: ['**/safe.test.js'],
testTimeout: 360 * 1000,
testMatch: ['**/safe.test.js', '**/trust.test.js'],
testTimeout: 30 * 1000,
verbose: true,
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"docs:serve": "documentation serve --watch ./src/**",
"docs:lint": "documentation lint ./src/**",
"lint": "eslint --ignore-path .gitignore --ignore-pattern lib .",
"test": "jest --runInBand",
"test": "jest",
"test:watch": "npm run test -- --watch"
},
"devDependencies": {
Expand Down
63 changes: 0 additions & 63 deletions test/helpers/addTrust.js

This file was deleted.

13 changes: 5 additions & 8 deletions test/helpers/setupAccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ export default async function setupAccount({ account, nonce }, core) {
safeMasterAddress,
},
safe,
utils,
web3,
} = core;
const safeAddress = await safe.predictAddress(account, { nonce });
let safeSdk;

return (
// Deploy manually a Safe
web3.eth
utils
.sendTransaction({
from: account.address,
to: proxyFactoryAddress,
value: 0,
target: proxyFactoryAddress,
data: proxyFactory.methods
.createProxyWithNonce(
safeMasterAddress,
Expand Down Expand Up @@ -60,10 +59,8 @@ export default async function setupAccount({ account, nonce }, core) {
.then((safeTx) => safeSdk.signTransaction(safeTx))
// Execute manually the transaction
.then((signedSafeTx) =>
web3.eth.sendTransaction({
from: account.address,
to: safeAddress,
value: 0,
utils.sendTransaction({
target: safeAddress,
data: getSafeContract(web3, safeAddress)
.methods.execTransaction(
signedSafeTx.data.to,
Expand Down
28 changes: 8 additions & 20 deletions test/safe.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { deployCRCVersionSafe } from './helpers/transactions';
import generateSaltNonce from './helpers/generateSaltNonce';
import setupAccount from './helpers/setupAccount';
import setupWeb3 from './helpers/setupWeb3';
// Temporary method for adding trusts with new relayer since trusts functionality is not yet migrated
import addTrust from './helpers/addTrust';

describe('Safe', () => {
const { web3, provider } = setupWeb3();
Expand Down Expand Up @@ -41,15 +39,10 @@ describe('Safe', () => {
// Let's make the trust connections needed to get the Safe deployed
await Promise.all(
predeployedSafes.map((predeployedAddress, index) =>
addTrust(
{
account: accounts[index + 1],
safeAddress: predeployedAddress,
safeAddressToTrust: safeAddress,
limitPercentage: 50,
},
core,
),
core.trust.addConnection(accounts[index + 1], {
canSendTo: predeployedAddress,
user: safeAddress,
}),
),
);

Expand Down Expand Up @@ -94,15 +87,10 @@ describe('Safe', () => {
// Let's make the trust connections needed to get the Safe deployed
await Promise.all(
predeployedSafes.map((predeployedAddress, index) =>
addTrust(
{
account: accounts[index + 1],
safeAddress: predeployedAddress,
safeAddressToTrust: safeAddress,
limitPercentage: 50,
},
core,
),
core.trust.addConnection(accounts[index + 1], {
canSendTo: predeployedAddress,
user: safeAddress,
}),
),
);

Expand Down
Loading

0 comments on commit c3a7139

Please sign in to comment.