diff --git a/.circleci/config.yml b/.circleci/config.yml
index 7a04354..9308fdb 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -13,6 +13,9 @@ jobs:
- 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
- run: yarn install
+ - run:
+ name: Run Unit Tests
+ command: yarn test:unit
- run:
name: Run Webpack
command: yarn dev
diff --git a/__mocks__/electron-is-dev.js b/__mocks__/electron-is-dev.js
new file mode 100644
index 0000000..35d4a32
--- /dev/null
+++ b/__mocks__/electron-is-dev.js
@@ -0,0 +1,5 @@
+module.exports = {
+ app: {
+ isPackaged: false,
+ },
+};
diff --git a/__tests__/components/__snapshots__/transaction-item.test.js.snap b/__tests__/components/__snapshots__/transaction-item.test.js.snap
new file mode 100644
index 0000000..b6618f3
--- /dev/null
+++ b/__tests__/components/__snapshots__/transaction-item.test.js.snap
@@ -0,0 +1,61 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[` should render a transaction item correctly 1`] = `
+
+
+
+
+
+
+
+ send
+
+
+ 16:31 PM
+
+
+
+
+ 12345678912345678912...9123456789
+
+
+
+
+ -ZEC 0.865
+
+
+ -USD $2.544
+
+
+
+
+`;
diff --git a/__tests__/components/__snapshots__/transactions-daily.test.js.snap b/__tests__/components/__snapshots__/transactions-daily.test.js.snap
new file mode 100644
index 0000000..017aff2
--- /dev/null
+++ b/__tests__/components/__snapshots__/transactions-daily.test.js.snap
@@ -0,0 +1,130 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[` render() should render user daily transactions 1`] = `
+
+
+
+ 2019-02-20T19:31:57.117Z
+
+
+
+
+
+
+
+
+ receive
+
+
+ 16:31 PM
+
+
+
+
+ 12345678912345678912...9123456789
+
+
+
+
+ +ZEC 1.789
+
+
+ +USD $2.406
+
+
+
+
+
+
+
+
+
+ send
+
+
+ 16:31 PM
+
+
+
+
+ 12345678912345678912...9123456789
+
+
+
+
+ -ZEC 0.846
+
+
+ -USD $1.138
+
+
+
+
+
+
+`;
diff --git a/__tests__/components/status-pill.test.js b/__tests__/components/status-pill.test.js
index 83250ea..ea690e7 100644
--- a/__tests__/components/status-pill.test.js
+++ b/__tests__/components/status-pill.test.js
@@ -11,20 +11,14 @@ import { appTheme } from '../../app/theme';
afterEach(cleanup);
describe('', () => {
- test('should render status pill correctly', () => {
- const { queryByTestId } = render(
-
-
- ,
- );
-
- expect(queryByTestId('StatusPill')).toBeInTheDocument();
- });
-
test('should show percentage on status pill syncing', () => {
const { container } = render(
-
+ Promise.resolve()}
+ nodeSyncProgress={56.0}
+ nodeSyncType='syncing'
+ />
,
);
@@ -34,7 +28,11 @@ describe('', () => {
test('should hide percentage on status pill', () => {
const { container } = render(
-
+ Promise.resolve()}
+ nodeSyncProgress={100.0}
+ nodeSyncType='ready'
+ />
,
);
@@ -44,7 +42,11 @@ describe('', () => {
test('should show error string and hide percentage on status pill', () => {
const { container } = render(
-
+ Promise.resolve()}
+ nodeSyncProgress={0.0}
+ nodeSyncType='error'
+ />
,
);
diff --git a/__tests__/components/transaction-item.test.js b/__tests__/components/transaction-item.test.js
index 44ff1ed..4f23fe4 100644
--- a/__tests__/components/transaction-item.test.js
+++ b/__tests__/components/transaction-item.test.js
@@ -19,7 +19,7 @@ describe('', () => {
address='123456789123456789123456789123456789'
transactionId='a0s9dujo23j0'
amount={0.8652}
- date={new Date().toISOString()}
+ date='2019-02-20T19:31:57.117Z'
zecPrice={2.94}
fees={0.0001}
/>
diff --git a/__tests__/components/transactions-daily.test.js b/__tests__/components/transactions-daily.test.js
index 44f768f..3a5fc8d 100644
--- a/__tests__/components/transactions-daily.test.js
+++ b/__tests__/components/transactions-daily.test.js
@@ -16,7 +16,7 @@ describe('', () => {
const { container } = render(
', () => {
address: '123456789123456789123456789123456789',
amount: 1.7891,
zecPrice: 1.345,
- date: new Date().toISOString(),
+ date: '2019-02-20T19:31:57.117Z',
theme: appTheme,
fees: 0.001,
},
@@ -35,7 +35,7 @@ describe('', () => {
address: '123456789123456789123456789123456789',
amount: 0.8458,
zecPrice: 1.344,
- date: new Date().toISOString(),
+ date: '2019-02-20T19:31:57.117Z',
theme: appTheme,
fees: 0.001,
},
diff --git a/__tests__/components/wallet-address.test.js b/__tests__/components/wallet-address.test.js
index 9940fe9..c79003a 100644
--- a/__tests__/components/wallet-address.test.js
+++ b/__tests__/components/wallet-address.test.js
@@ -12,16 +12,14 @@ afterEach(cleanup);
describe('', () => {
test('should render wallet address component correctly', () => {
- const { queryByTestId } = render(
+ const { getByText } = render(
-
+
,
);
- expect(queryByTestId('Address')).toBeInTheDocument();
+ expect(getByText('t14oHp2v54vfmdgQ3v3SNuQga8JKHTNi2a1')).toBeInTheDocument();
});
});
diff --git a/__tests__/services/zec-price.test.js b/__tests__/services/zec-price.test.js
new file mode 100644
index 0000000..3ce272f
--- /dev/null
+++ b/__tests__/services/zec-price.test.js
@@ -0,0 +1,15 @@
+// @flow
+
+import getZECPrice from '../../services/zec-price';
+
+describe('ZEC PRICE Services', () => {
+ test('should return the right value', async () => {
+ const response = await getZECPrice(['BRL', 'EUR', 'USD']);
+
+ expect(response).toEqual({
+ USD: expect.any(Number),
+ BRL: expect.any(Number),
+ EUR: expect.any(Number),
+ });
+ });
+});
diff --git a/app/components/header.js b/app/components/header.js
index 97b23ed..bfaa431 100644
--- a/app/components/header.js
+++ b/app/components/header.js
@@ -7,9 +7,7 @@ import { ZcashLogo } from './zcash-logo';
import { TextComponent } from './text';
import { Divider } from './divider';
import { RowComponent } from './row';
-import { StatusPill } from './status-pill';
-
-import { withSyncStatus } from '../../services/sync-status';
+import { StatusPillContainer } from '../containers/status-pill';
const Wrapper = styled.div`
height: ${props => props.theme.headerHeight};
@@ -62,8 +60,6 @@ type Props = {
title: string,
};
-const Status = withSyncStatus(StatusPill);
-
export const HeaderComponent = ({ title }: Props) => (