Skip to content

Commit

Permalink
Added smart node selector (#87)
Browse files Browse the repository at this point in the history
* Refactoring: converted to TypeScript.

Adjusted the JS/TS linting environment.
Also added validation of JavaScript/Typescript code to GitHub workflow.

* Added new component: SmartNodeSelector

Also added new component to App.js in order to preview and test.

Set up Jest testing framework

Refactored folder structure and added debug config for tests in VS Code.

Implemented fast and smart code to allow for large data sets
- Fast data searching algorithm
- Smart rendering
  • Loading branch information
rubenthoms authored Mar 11, 2021
1 parent 6bf84e5 commit 3ae58e7
Show file tree
Hide file tree
Showing 37 changed files with 11,555 additions and 3,526 deletions.
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ demo/.*\.js
demo/.*\.html
demo/.*\.css

# ignore python files/folders
# ignore Python files/folders
setup.py
usage.py
setup.py
Expand Down
12 changes: 10 additions & 2 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@
}
}
],
"@babel/preset-react"
"@babel/preset-react",
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-proposal-class-properties"
]
],
"env": {
"test": {
"plugins": [
"transform-es2015-modules-commonjs"
]
}
}
}
5 changes: 3 additions & 2 deletions .github/workflows/webviz-core-components.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ jobs:
- name: 🕵️ Check code style & linting
run: |
npm run validate
black --check webviz_core_components tests setup.py
black --check webviz_core_components tests setup.py usage.py
bandit -r -c ./bandit.yml webviz_core_components tests setup.py
- name: 🤖 Run tests
run: |
pytest ./tests --headless
npm run test
pytest ./tests/py --headless
- name: 🚢 Build and deploy Python package
if: github.event_name == 'release' && matrix.python-version == '3.6'
Expand Down
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@
"request": "launch",
"name": "Launch Webpack",
"program": "${workspaceFolder}/node_modules/webpack/bin/webpack.js"
},
{
"name": "Debug Jest Tests",
"type": "node",
"request": "launch",
"runtimeArgs": [
"--inspect-brk",
"${workspaceRoot}/node_modules/.bin/jest",
"--runInBand"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"port": 9229
}
]
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [UNRELEASED] - YYYY-MM-DD
### Changed
- [#86](https://github.com/equinor/webviz-core-components/pull/86) - Refactored and converted code to TypeScript (main component files to JSX), adjusted build environment accordingly and added validation of JS/TS to GitHub workflow

### Added
- [#87](https://github.com/equinor/webviz-core-components/pull/87) - Added new SmartNodeSelector component and Jest testing framework
1 change: 1 addition & 0 deletions __mocks__/fileMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = 'test-file-stub';
1 change: 1 addition & 0 deletions __mocks__/styleMock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {};
23 changes: 23 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
transform: { ".*": "<rootDir>/node_modules/babel-jest" },
rootDir: ".",
testMatch: ["**/tests/js/**/*.test.[jt]s?(x)", "**/?(*.)+(spec|test).[jt]s?(x)"],
modulePaths: ["/shared/vendor/modules"],
moduleFileExtensions: ["js", "jsx", "ts", "tsx"],
moduleDirectories: [
'node_modules',
'tests/js/',
],
moduleNameMapper: {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":
"<rootDir>/__mocks__/fileMock.js",
"\\.(css|less)$": "<rootDir>/__mocks__/styleMock.js"
},
transformIgnorePatterns: ["/node_modules/"],
unmockedModulePathPatterns: [
"<rootDir>/node_modules/react",
"<rootDir>/node_modules/react-dom",
"<rootDir>/node_modules/react-addons-test-utils",
"<rootDir>/EmptyModule.js"
]
}
Loading

0 comments on commit 3ae58e7

Please sign in to comment.