Skip to content
This repository has been archived by the owner on Mar 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #82 from andrerfneves/develop
Browse files Browse the repository at this point in the history
Release Candidate 1
  • Loading branch information
andrerfneves authored Feb 24, 2019
2 parents 03c4eac + e9f2944 commit 5a36f2f
Show file tree
Hide file tree
Showing 218 changed files with 24,516 additions and 19,267 deletions.
67 changes: 62 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ jobs:
- run: apt-get -y update
- run: apt-get -y install libusb-1.0-0-dev graphicsmagick libudev-dev
- run: apt-get -y install tmux xvfb libxtst6 libxss1 libgtk2.0-0 libnss3 libasound2 libgconf-2-4 ffmpeg frei0r-plugins
# TODO: Just a quick try
- run: rm yarn.lock
- run: yarn install
- run:
name: Run Unit Tests
command: yarn test:unit
- run:
name: Run Webpack
command: yarn dev
Expand All @@ -35,14 +36,70 @@ jobs:
kill -s SIGINT $(pgrep ffmpeg)
sleep 10
kill -s SIGTERM $(pgrep Xvfb)
- save_cache:
key: zec-dependencies-cache-{{ checksum "yarn.lock" }}
paths:
- /usr/local/share/.cache/yarn/v2
- ./node_modules
- store_artifacts:
path: /tmp/e2e-record.mp4
destination: e2e-record.mp4

build_linux:
docker:
- image: electronuserland/builder:wine-chrome
steps:
- checkout
- restore_cache:
key: zec-dependencies-cache-{{ checksum "yarn.lock" }}
- run: yarn electron:dist -l
- store_artifacts:
path: ./dist/zec-react-wallet_0.3.0_amd64.deb
destination: zec-react-wallet_0.3.0_amd64.deb
- run:
name: Upload to Slack
command: |
export GIT_COMMIT_DESC=$(git log --format=oneline -n 1 | sed -E 's/^[^ ]+ (.*)$/\1/g')
curl -F file=@dist/zec-react-wallet_0.3.0_amd64.deb -F channels=$SLACK_CHANNEL -F token=$SLACK_API_TOKEN -F title="${CIRCLE_PROJECT_REPONAME} | branch -> ${CIRCLE_BRANCH} | commit -> ${GIT_COMMIT_DESC}" https://slack.com/api/files.upload
build_windows:
docker:
- image: electronuserland/builder:wine-chrome
steps:
- checkout
- restore_cache:
key: zec-dependencies-cache-{{ checksum "yarn.lock" }}
- run:
name: Download PFX certificate
command: echo ${WIN_CERTIFICATE_PFX} | base64 --decode > win-certificate.pfx
- run:
name: Build Windows Installer
command: yarn electron:dist -w
- store_artifacts:
path: ./dist/ZEC Wallet Setup 0.3.0.exe
destination: ZEC Wallet Setup 0.3.0.exe
- run:
name: Upload to Slack
command: |
export GIT_COMMIT_DESC=$(git log --format=oneline -n 1 | sed -E 's/^[^ ]+ (.*)$/\1/g')
curl -F file="@dist/ZEC Wallet Setup 0.3.0.exe" -F channels=$SLACK_CHANNEL -F token=$SLACK_API_TOKEN -F title="${CIRCLE_PROJECT_REPONAME} | branch -> ${CIRCLE_BRANCH} | commit -> ${GIT_COMMIT_DESC}" https://slack.com/api/files.upload
workflows:
version: 2
test:
build_test:
jobs:
- test:
- test
- build_linux:
requires:
- test
filters:
branches:
only:
- master
- build_windows:
requires:
- test
filters:
branches:
only: feature/e2e
only:
- master
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flow-custom-typedefs/*.js
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"rules": {
"jsx-quotes": ["error", "prefer-single"],
"import/prefer-default-export": ["off"],
"import/no-default-export": 1,
"react/jsx-filename-extension": [1, { "extensions": [".js"] }],
"jsx-a11y/anchor-is-valid": [
"error",
Expand Down
6 changes: 4 additions & 2 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
[ignore]
.*/node_modules/polished/.*
./__tests__
./__tests__/**.js
./flow-typed/npm/styled-components_v4.x.x.js

[include]

[libs]
flow-typed
flow-custom-typedefs

[lints]

[options]
esproposal.optional_chaining=enable

[strict]
[strict]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Reference Wallet for the Zcash Network

[![CircleCI](https://circleci.com/gh/andrerfneves/zec-react-wallet.svg?style=svg&circle-token=abde48de664026a5d03d4b806c904c8ce5e45aa0)](https://circleci.com/gh/andrerfneves/zec-react-wallet) ![Flow Coverage](./public/flow-coverage-badge.svg)

## Stack Information

- [Electron](https://github.com/electron/electron): desktop application builder
Expand Down
5 changes: 5 additions & 0 deletions __mocks__/electron-is-dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
app: {
isPackaged: false,
},
};
49 changes: 49 additions & 0 deletions __tests__/actions/receive.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// @flow

import configureStore from 'redux-mock-store';

import {
LOAD_ADDRESSES_SUCCESS,
LOAD_ADDRESSES_ERROR,
loadAddressesSuccess,
loadAddressesError,
} from '../../app/redux/modules/receive';

const store = configureStore()();

describe('Receive Actions', () => {
beforeEach(() => store.clearActions());

test('should create an action to load addresses with success', () => {
const payload = {
addresses: [
'tm0a9si0ds09gj02jj',
'smas098gk02jf0kskk',
],
};

store.dispatch(loadAddressesSuccess(payload));

expect(store.getActions()[0]).toEqual(
expect.objectContaining({
type: LOAD_ADDRESSES_SUCCESS,
payload,
}),
);
});

test('should create an action to load addresses with error', () => {
const payload = {
error: 'Something went wrong!',
};

store.dispatch(loadAddressesError(payload));

expect(store.getActions()[0]).toEqual(
expect.objectContaining({
type: LOAD_ADDRESSES_ERROR,
payload,
}),
);
});
});
116 changes: 116 additions & 0 deletions __tests__/actions/send.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// @flow

import configureStore from 'redux-mock-store';

import {
SEND_TRANSACTION,
SEND_TRANSACTION_SUCCESS,
SEND_TRANSACTION_ERROR,
RESET_SEND_TRANSACTION,
VALIDATE_ADDRESS_SUCCESS,
VALIDATE_ADDRESS_ERROR,
LOAD_ZEC_PRICE,
sendTransaction,
sendTransactionSuccess,
sendTransactionError,
resetSendTransaction,
validateAddressSuccess,
validateAddressError,
loadZECPrice,
} from '../../app/redux/modules/send';

const store = configureStore()();

describe('Send Actions', () => {
beforeEach(() => store.clearActions());

test('should create an action to send a transaction', () => {
store.dispatch(sendTransaction());

expect(store.getActions()[0]).toEqual(
expect.objectContaining({
type: SEND_TRANSACTION,
}),
);
});

test('should create an action to send transaction with success', () => {
const payload = {
operationId: '0b9ii4590ab-1d012klfo',
};

store.dispatch(sendTransactionSuccess(payload));

expect(store.getActions()[0]).toEqual(
expect.objectContaining({
type: SEND_TRANSACTION_SUCCESS,
payload,
}),
);
});

test('should create an action to send transaction with error', () => {
const payload = {
error: 'Something went wrong!',
};

store.dispatch(sendTransactionError(payload));

expect(store.getActions()[0]).toEqual(
expect.objectContaining({
type: SEND_TRANSACTION_ERROR,
payload,
}),
);
});

test('should reset a transaction', () => {
store.dispatch(resetSendTransaction());

expect(store.getActions()[0]).toEqual(
expect.objectContaining({
type: RESET_SEND_TRANSACTION,
}),
);
});

test('should validate a address with success', () => {
const payload = {
isValid: true,
};

store.dispatch(validateAddressSuccess(payload));

expect(store.getActions()[0]).toEqual(
expect.objectContaining({
type: VALIDATE_ADDRESS_SUCCESS,
payload,
}),
);
});

test('should validate a address with error', () => {
store.dispatch(validateAddressError());

expect(store.getActions()[0]).toEqual(
expect.objectContaining({
type: VALIDATE_ADDRESS_ERROR,
}),
);
});

test('should load ZEC price', () => {
const payload = {
value: 1.35,
};

store.dispatch(loadZECPrice(payload));

expect(store.getActions()[0]).toEqual(
expect.objectContaining({
type: LOAD_ZEC_PRICE,
payload,
}),
);
});
});
60 changes: 60 additions & 0 deletions __tests__/actions/transactions.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// @flow

import configureStore from 'redux-mock-store';

import {
LOAD_TRANSACTIONS,
LOAD_TRANSACTIONS_SUCCESS,
LOAD_TRANSACTIONS_ERROR,
loadTransactions,
loadTransactionsSuccess,
loadTransactionsError,
} from '../../app/redux/modules/transactions';

const store = configureStore()();

describe('Transactions Actions', () => {
beforeEach(() => store.clearActions());

test('should create an action to load transactions', () => {
store.dispatch(loadTransactions());

expect(store.getActions()[0]).toEqual(
expect.objectContaining({
type: LOAD_TRANSACTIONS,
}),
);
});

test('should create an action to load transactions with success', () => {
const payload = {
list: [],
zecPrice: 0,
hasNextPage: false,
};

store.dispatch(loadTransactionsSuccess(payload));

expect(store.getActions()[0]).toEqual(
expect.objectContaining({
type: LOAD_TRANSACTIONS_SUCCESS,
payload,
}),
);
});

test('should create an action to load transactions with error', () => {
const payload = {
error: 'Something went wrong!',
};

store.dispatch(loadTransactionsError(payload));

expect(store.getActions()[0]).toEqual(
expect.objectContaining({
type: LOAD_TRANSACTIONS_ERROR,
payload,
}),
);
});
});
Loading

0 comments on commit 5a36f2f

Please sign in to comment.