diff --git a/.babelrc b/.babelrc index e6b4c23b..ed6e37fc 100644 --- a/.babelrc +++ b/.babelrc @@ -15,5 +15,15 @@ "react", "stage-0" ], - "plugins": [["module-resolver", { "root": ["src"] }], "styled-components"] + "plugins": [["module-resolver", { "root": ["src"] }], "styled-components"], + "env": { + "test": { + "presets": [ + "env", + "stage-0", + "react", + ], + "plugins": [["module-resolver", { "root": ["src"] }], "styled-components"], + } + } } diff --git a/.eslintrc b/.eslintrc index 5a756dc6..77008378 100644 --- a/.eslintrc +++ b/.eslintrc @@ -14,6 +14,9 @@ "document": false, "HTMLDivElement": false, "ResizeObserver": false, + "jest": false, + "describe": false, + "test": false, }, "rules": { "camelcase": 0, diff --git a/package.json b/package.json index e77775f1..4c2f0c23 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "compile": "bash ./scripts/dist.sh", "dist:dir": "yarn dist --dir -c.compression=store -c.mac.identity=null", "dist": "yarn compile && electron-builder", + "test": "jest", "flow": "flow", "flow-typed": "flow-typed install -s --overwrite", "lint": "eslint src webpack .storybook", @@ -133,6 +134,7 @@ "flow-typed": "^2.3.0", "hard-source-webpack-plugin": "^0.6.0", "husky": "^0.14.3", + "jest": "^22.4.2", "js-yaml": "^3.10.0", "lint-staged": "^7.0.0", "node-loader": "^0.6.0", diff --git a/src/components/AccountPage.js b/src/components/AccountPage.js index 91822a36..2f94a9e3 100644 --- a/src/components/AccountPage.js +++ b/src/components/AccountPage.js @@ -59,7 +59,7 @@ class AccountPage extends PureComponent { - {t('send.title')} + {t('send:title')} diff --git a/src/components/SettingsPage/index.js b/src/components/SettingsPage/index.js index 44bd987a..c71fd562 100644 --- a/src/components/SettingsPage/index.js +++ b/src/components/SettingsPage/index.js @@ -66,49 +66,49 @@ class SettingsPage extends PureComponent { return ( - {t('settings.title')} + {t('settings:title')} , }, { key: 'money', isDisabled: true, - title: t('settings.tabs.money'), + title: t('settings:tabs.money'), render: () =>
{'Monnaie'}
, }, { key: 'material', isDisabled: true, - title: t('settings.tabs.material'), + title: t('settings:tabs.material'), render: () =>
{'Matériel'}
, }, { key: 'app', isDisabled: true, - title: t('settings.tabs.app'), + title: t('settings:tabs.app'), render: () =>
{'App (beta)'}
, }, { key: 'tools', isDisabled: true, - title: t('settings.tabs.tools'), + title: t('settings:tabs.tools'), render: () =>
{'Outils'}
, }, { key: 'blockchain', isDisabled: true, - title: t('settings.tabs.blockchain'), + title: t('settings:tabs.blockchain'), render: () =>
{'Blockchain'}
, }, { key: 'profile', - title: t('settings.tabs.profile'), + title: t('settings:tabs.profile'), render: () => , }, ]} diff --git a/src/components/SideBar/index.js b/src/components/SideBar/index.js index 9d6af555..ffbafb06 100644 --- a/src/components/SideBar/index.js +++ b/src/components/SideBar/index.js @@ -73,26 +73,26 @@ class SideBar extends PureComponent { - {t('sidebar.menu')} + {t('sidebar:menu')} } linkTo="/"> - {t('dashboard.title')} + {t('dashboard:title')} } modal={MODAL_SEND}> - {t('send.title')} + {t('send:title')} } modal={MODAL_RECEIVE}> - {t('receive.title')} + {t('receive:title')} } linkTo="/settings"> - {t('settings.title')} + {t('settings:title')} - {t('sidebar.accounts')} - t('addAccount.title')} offset={[0, 1]}> + {t('sidebar:accounts')} + t('addAccount:title')} offset={[0, 1]}> openModal(MODAL_ADD_ACCOUNT)}> diff --git a/src/components/TopBar.js b/src/components/TopBar.js index db0024cb..5bb3bced 100644 --- a/src/components/TopBar.js +++ b/src/components/TopBar.js @@ -168,14 +168,14 @@ class TopBar extends PureComponent { items={[ { key: 'profile', - label: t('mainDropdown.editProfile'), + label: t('common:editProfile'), icon: , }, ...(hasPassword ? [ { key: 'lock', - label: t('mainDropdown.lockApplication'), + label: t('common:lockApplication'), icon: , onClick: this.handleLock, }, diff --git a/src/components/TransactionsList/index.js b/src/components/TransactionsList/index.js index a3a5bef7..b3e98b59 100644 --- a/src/components/TransactionsList/index.js +++ b/src/components/TransactionsList/index.js @@ -126,7 +126,7 @@ const Transaction = ({ }} > - {tx.balance > 0 ? t('transactionsList.from') : t('transactionsList.to')} + {tx.balance > 0 ? t('transactionsList:from') : t('transactionsList:to')} { return ( - {t('transactionsList.date')} + {t('transactionsList:date')} {withAccounts && ( - {t('transactionsList.account')} + {t('transactionsList:account')} )} - {t('transactionsList.address')} + {t('transactionsList:address')} - {t('transactionsList.amount')} + {t('transactionsList:amount')} diff --git a/src/components/UpdateNotifier.js b/src/components/UpdateNotifier.js index fbce9be9..ae3fda7c 100644 --- a/src/components/UpdateNotifier.js +++ b/src/components/UpdateNotifier.js @@ -57,12 +57,12 @@ class UpdateNotifier extends PureComponent { case 'downloaded': return ( - {t('update.newVersionReady')} + {t('update:newVersionReady')} sendEvent('msg', 'updater.quitAndInstall')} + onClick={() => sendEvent('msg', 'updater:quitAndInstall')} > - {t('update.relaunch')} + {t('update:relaunch')} ) diff --git a/src/components/modals/AddAccount/ImportAccounts.js b/src/components/modals/AddAccount/ImportAccounts.js index ccc893c1..706727bb 100644 --- a/src/components/modals/AddAccount/ImportAccounts.js +++ b/src/components/modals/AddAccount/ImportAccounts.js @@ -27,7 +27,7 @@ class ImportAccounts extends PureComponent { accountsSelected: [], accountsName: this.props.accounts.reduce((result, value, index) => { result[value.id] = { - placeholder: this.props.t(`addAccount.import.placeholder`, { + placeholder: this.props.t(`addAccount:placeholder`, { index: index + 1, }), } diff --git a/src/components/modals/AddAccount/index.js b/src/components/modals/AddAccount/index.js index 025e73f0..251752cb 100644 --- a/src/components/modals/AddAccount/index.js +++ b/src/components/modals/AddAccount/index.js @@ -45,9 +45,9 @@ const Steps = { - +