Skip to content

Commit

Permalink
Merge pull request #648 from lidofinance/feature/pretty-tests
Browse files Browse the repository at this point in the history
💅 tests
  • Loading branch information
TheDZhon authored Feb 22, 2023
2 parents e575177 + 9974172 commit b609306
Show file tree
Hide file tree
Showing 114 changed files with 6,309 additions and 5,042 deletions.
3 changes: 2 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ charset = utf-8
indent_style = space
indent_size = 4

[*.{js,yml}]
[*.{js,yml,json,cjs}]
indent_size = 2
max_line_length = 120
33 changes: 10 additions & 23 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,45 +1,32 @@
{
"plugins": ["prettier", "standard"],
"env": {
"node": true,
"es2020": true
"es2022": true
},
"extends": ["standard", "plugin:prettier/recommended", "prettier", "prettier/standard"],
"parser": "babel-eslint",
"extends": ["standard", "plugin:prettier/recommended"],
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module",
"ecmaVersion": 2022,
"sourceType": "script",
"ecmaFeatures": {
"jsx": true,
"modules": true
"jsx": true
}
},
"plugins": ["node", "prettier", "standard"],

"rules": {
"prettier/prettier": "error",
"max-len": ["warn", { "code": 140, "ignoreComments": true, "ignoreUrls": true }],
"no-undef": "warn",
"no-unused-vars": "warn",
"prefer-const": "warn",
"camelcase": "off",
"eol-last": "warn",
"no-multiple-empty-lines": "warn",
"comma-dangle": "warn",
"quotes": ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": true }],
"jsx-quotes": ["error", "prefer-single"],
"no-useless-escape": "off",
"linebreak-style": ["error", "unix"]
"no-restricted-modules": ["error", {
"name": "@aragon/contract-helpers-test/src/asserts",
"message": "Please use helpers/assert instead."
}]
},
"overrides": [
{
"files": ["./scripts/{**/,}*.js", "./test/{**/,}*.js", "./e2e/test/{**/,}*.js"],
"env": {
"mocha": true
},
"globals": {
"artifacts": "readonly",
"contract": "readonly",
"web3": "readonly"
}
}
]
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ jobs:

- name: Run JS linters
run: yarn lint:js
continue-on-error: true

coverage:
name: Solidity coverage
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ cli/vendor

# foundry artifacts
foundry/cache
foundry/out
foundry/out
5 changes: 2 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
. "$(dirname -- "$0")/_/husky.sh"

yarn compile
yarn lint:sol
git diff --quiet lib/abi

# TODO: uncomment. it's temporarily disabled on staking_router + withdrawals-poc merge
# yarn lint:js:fix
yarn lint
17 changes: 3 additions & 14 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
{
"singleQuote": true,
"semi": false,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"printWidth": 120,
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 120,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": false
}
}
]
"options": {
"editorconfig": true
}
}
18 changes: 9 additions & 9 deletions apps/lido/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,25 @@
"yup": "^0.29.3"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.11.5",
"@babel/preset-react": "^7.10.1",
"babel-eslint": "^10.1.0",
"babel-plugin-styled-components": "^1.11.1",
"copyfiles": "^2.3.0",
"eslint": "^7.9.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-standard": "^14.1.1",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-standard": "^17.0.0",
"eslint-config-standard-react": "^9.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-standard": "^5.0.0",
"parcel-bundler": "^1.12.4",
"prettier": "^2.1.2"
"prettier": "^2.8.4"
},
"scripts": {
"build": "yarn sync-assets && yarn build:app && yarn build:script",
Expand Down
6 changes: 3 additions & 3 deletions apps/lido/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
...baseConfig,
paths: {
...baseConfig.paths,
root: '../..'
root: '../..',
},
defaultNetwork: process.env.NETWORK_NAME || 'localhost',
// Aragon plugin configuration
Expand All @@ -18,6 +18,6 @@ module.exports = {
appSrcPath: 'apps/lido/app/',
appBuildOutputPath: 'apps/lido/dist/',
appName: 'lido',
hooks // Path to script hooks
}
hooks, // Path to script hooks
},
}
2 changes: 1 addition & 1 deletion apps/lido/scripts/buidler-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ module.exports = {
},

// Called after the app's proxy is updated with a new implementation.
postUpdate: async ({ proxy, log }, { web3, artifacts }) => {}
postUpdate: async ({ proxy, log }, { web3, artifacts }) => {},
}
18 changes: 9 additions & 9 deletions apps/node-operators-registry/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@
"yup": "^0.29.3"
},
"devDependencies": {
"@babel/core": "^7.11.6",
"@babel/core": "^7.21.0",
"@babel/preset-env": "^7.11.5",
"@babel/preset-react": "^7.10.1",
"babel-eslint": "^10.1.0",
"babel-plugin-styled-components": "^1.11.1",
"copyfiles": "^2.3.0",
"eslint": "^7.9.0",
"eslint-config-prettier": "^6.11.0",
"eslint-config-standard": "^14.1.1",
"eslint": "^8.34.0",
"eslint-config-prettier": "^8.6.0",
"eslint-config-standard": "^17.0.0",
"eslint-config-standard-react": "^9.2.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2",
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-standard": "^5.0.0",
"parcel-bundler": "^1.12.4",
"prettier": "^2.1.2"
"prettier": "^2.8.4"
},
"scripts": {
"build": "yarn sync-assets && yarn build:app && yarn build:script",
Expand Down
6 changes: 3 additions & 3 deletions apps/node-operators-registry/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
...baseConfig,
paths: {
...baseConfig.paths,
root: '../..'
root: '../..',
},
defaultNetwork: process.env.NETWORK_NAME || 'localhost',
// Aragon plugin configuration
Expand All @@ -18,6 +18,6 @@ module.exports = {
appSrcPath: 'apps/node-operators-registry/app/',
appBuildOutputPath: 'apps/node-operators-registry/dist/',
appName: 'node-operators-registry',
hooks // Path to script hooks
}
hooks, // Path to script hooks
},
}
2 changes: 1 addition & 1 deletion apps/node-operators-registry/scripts/buidler-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ module.exports = {
},

// Called after the app's proxy is updated with a new implementation.
postUpdate: async ({ proxy, log }, { web3, artifacts }) => {}
postUpdate: async ({ proxy, log }, { web3, artifacts }) => {},
}
6 changes: 3 additions & 3 deletions ava.config.cjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
require: ['@babel/register'],
files: ['e2e/test/**/*.test.js'],
concurrency: 5
require: ['@babel/register'],
files: ['e2e/test/**/*.test.js'],
concurrency: 5,
}
12 changes: 8 additions & 4 deletions gasprofile/tx-deposit.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function main() {
user1,
user2,
// an unrelated address
nobody
nobody,
] = addresses

const deployed = await deployDaoAndPool(appManager, voting, 100)
Expand All @@ -38,14 +38,18 @@ async function main() {
const numKeys = 3

for (let iProvider = 0; iProvider < numProviders; ++iProvider) {
const nosTx = await nodeOperatorRegistry.addNodeOperator(`NOS-${iProvider}`, nodeOperator, nosValidatorsLimit, { from: voting })
const nodeOperatorId = getEventArgument(nosTx, 'NodeOperatorAdded', 'nodeOperatorId', { decodeForAbi: NodeOperatorsRegistry._json.abi })
const nosTx = await nodeOperatorRegistry.addNodeOperator(`NOS-${iProvider}`, nodeOperator, nosValidatorsLimit, {
from: voting,
})
const nodeOperatorId = getEventArgument(nosTx, 'NodeOperatorAdded', 'nodeOperatorId', {
decodeForAbi: NodeOperatorsRegistry._json.abi,
})

const data = Array.from({ length: numKeys }, (_, iKey) => {
const n = arbitraryN.clone().addn(10 * iKey + 1000 * iProvider)
return {
key: pad(`0x${n.toString(16)}`, 48, 'd'),
sig: pad(`0x${n.toString(16)}`, 96, 'e')
sig: pad(`0x${n.toString(16)}`, 96, 'e'),
}
})

Expand Down
4 changes: 2 additions & 2 deletions hardhat.config.aragon-apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ module.exports = {
...baseConfig,
aragon: {
...baseConfig.aragon,
...aragonConfig
}
...aragonConfig,
},
}
Loading

0 comments on commit b609306

Please sign in to comment.