diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f929aedda7a..76f4b5433d3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: - deploy variables: GIT_DEPTH: "3" - SIMPLECOV: "true" + SIMPLECOV: "true" RUST_BACKTRACE: "1" cache: key: "$CI_BUILD_NAME/$CI_BUILD_REF_NAME" @@ -244,7 +244,9 @@ test-linux: stage: test before_script: - git submodule update --init --recursive + - ./js/scripts/install-deps.sh script: + - ./js/scripts/test.sh - ./test.sh --verbose tags: - rust-test diff --git a/js/scripts/check-master.sh b/js/scripts/check-master.sh deleted file mode 100644 index a3f80d4bd93..00000000000 --- a/js/scripts/check-master.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -PROTECTED_BRANCH='master' -CURRENT_BRANCH=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') - -if [ $PROTECTED_BRANCH = $CURRENT_BRANCH ]; -then - echo "Direct commits to the branch master are not allowed" - exit 1 -fi diff --git a/js/scripts/deploy-to-gh-pages.sh b/js/scripts/deploy-to-gh-pages.sh deleted file mode 100644 index 4458816355e..00000000000 --- a/js/scripts/deploy-to-gh-pages.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# See https://medium.com/@nthgergo/publishing-gh-pages-with-travis-ci-53a8270e87db -set -o errexit - -SOURCE_BRANCH="master" -TARGET_BRANCH="gh-pages" -GIT_USER_EMAIL="admin@travis-ci.org" -GIT_USER_NAME="Travis CI" -SHA=$(git rev-parse --verify HEAD) # reference to commit deployed to TARGET_BRANCH -COMMIT_MSG="Deploy to Github Pages: ${SHA}" - -# Don't deploy if -# 1. Pull request -# 2. Not target branch -# 3. Forked repo - -if [[ ("$TRAVIS_PULL_REQUEST" != "false") || ("$TRAVIS_BRANCH" != "$SOURCE_BRANCH") || ("$TRAVIS_REPO_SLUG" != "$REPO_SLUG") ]]; then - echo 'Not deploying'; - exit 0 -fi - - -# config -git config --global user.email "$GIT_USER_EMAIL" -git config --global user.name "$GIT_USER_NAME" - -# deploy -cd lib -git init -git add . -git commit -m "$COMMIT_MSG" - -git push -f --quiet "https://${GITHUB_TOKEN}@github.com/${REPO_SLUG}.git" $SOURCE_BRANCH:$TARGET_BRANCH > /dev/null 2>&1 diff --git a/js/scripts/install-deps.sh b/js/scripts/install-deps.sh new file mode 100755 index 00000000000..9a89382a193 --- /dev/null +++ b/js/scripts/install-deps.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# change into the js directory (one down from scripts) +pushd `dirname $0` +cd .. + +# install deps and store the exit code +npm install +EXICCODE=$? + +# back to root +popd + +# exit with exit code +exit $EXITCODE diff --git a/js/scripts/test.sh b/js/scripts/test.sh new file mode 100755 index 00000000000..4bc7661ebf4 --- /dev/null +++ b/js/scripts/test.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# change into the js directory (one down from scripts) +pushd `dirname $0` +cd .. + +# run lint & tests and store the exit code +npm run lint && npm run test +EXICCODE=$? + +# back to root +popd + +# exit with exit code +exit $EXITCODE diff --git a/js/src/api/transport/ws/ws.js b/js/src/api/transport/ws/ws.js index b2fb26f56d6..e11db306a09 100644 --- a/js/src/api/transport/ws/ws.js +++ b/js/src/api/transport/ws/ws.js @@ -32,7 +32,7 @@ export default class Ws extends JsonRpcBase { _onMessage = (event) => { const result = JSON.parse(event.data); - const {resolve, reject} = this._messages[result.id]; + const { resolve, reject } = this._messages[result.id]; if (result.error) { this.error(event.data); diff --git a/js/src/dapps/registry.js b/js/src/dapps/registry.js index 28e217d4142..c248767cefd 100644 --- a/js/src/dapps/registry.js +++ b/js/src/dapps/registry.js @@ -25,10 +25,8 @@ import './style.css'; import './registry.html'; ReactDOM.render( - ( - - - - ), + + + , document.querySelector('#container') ); diff --git a/js/src/dapps/registry/Application/application.js b/js/src/dapps/registry/Application/application.js index 9c825a0f0fd..a72d9bced11 100644 --- a/js/src/dapps/registry/Application/application.js +++ b/js/src/dapps/registry/Application/application.js @@ -33,7 +33,9 @@ export default class Application extends Component { } Application.propTypes = { + actions: PropTypes.object, contract: PropTypes.object, fee: PropTypes.object, + lookup: PropTypes.object, owner: PropTypes.string }; diff --git a/js/src/dapps/registry/Lookup/reducers.js b/js/src/dapps/registry/Lookup/reducers.js index dc0aa80b31c..384517ba49b 100644 --- a/js/src/dapps/registry/Lookup/reducers.js +++ b/js/src/dapps/registry/Lookup/reducers.js @@ -5,26 +5,29 @@ const initialState = { }; export default (state = initialState, action) => { - if (action.type === 'lookup start') + if (action.type === 'lookup start') { return { pending: true, name: action.name, key: action.key, result: null }; + } - if (action.type === 'lookup error') + if (action.type === 'lookup error') { return { pending: false, name: null, key: null, result: null }; + } - if (action.type === 'lookup success') + if (action.type === 'lookup success') { return { pending: false, name: null, key: null, result: action.result }; + } return state; }; diff --git a/js/src/dapps/registry/reducers.js b/js/src/dapps/registry/reducers.js index ee05f5f7ed6..05e794d0b4a 100644 --- a/js/src/dapps/registry/reducers.js +++ b/js/src/dapps/registry/reducers.js @@ -8,14 +8,17 @@ const initialState = { }; export default (state = initialState, action) => { - if (action.type === 'set contract') + if (action.type === 'set contract') { return { ...state, contract: action.contract }; + } - if (action.type === 'set fee') + if (action.type === 'set fee') { return { ...state, fee: action.fee }; + } - if (action.type === 'set owner') + if (action.type === 'set owner') { return { ...state, owner: action.owner }; + } if (action.type.slice(0, 6) === 'lookup') { return { ...state, lookup: lookupReducer(state.lookup, action) };