diff options
author | Chi Kei Chan <chikeichan@gmail.com> | 2019-03-22 07:03:30 +0800 |
---|---|---|
committer | Dan J Miller <danjm.com@gmail.com> | 2019-03-22 07:03:30 +0800 |
commit | 31175625b446cb5d18b17db23018bca8b14d280c (patch) | |
tree | f54e159883deef003fb281267025edf796eb8004 /ui/app/ducks/tests/send-duck.test.js | |
parent | 7287133e15fab22299e07704206e85bc855d1064 (diff) | |
download | tangerine-wallet-browser-31175625b446cb5d18b17db23018bca8b14d280c.tar tangerine-wallet-browser-31175625b446cb5d18b17db23018bca8b14d280c.tar.gz tangerine-wallet-browser-31175625b446cb5d18b17db23018bca8b14d280c.tar.bz2 tangerine-wallet-browser-31175625b446cb5d18b17db23018bca8b14d280c.tar.lz tangerine-wallet-browser-31175625b446cb5d18b17db23018bca8b14d280c.tar.xz tangerine-wallet-browser-31175625b446cb5d18b17db23018bca8b14d280c.tar.zst tangerine-wallet-browser-31175625b446cb5d18b17db23018bca8b14d280c.zip |
Folder restructure (#6304)
* Remove ui/app/keychains/
* Remove ui/app/img/ (unused images)
* Move conversion-util to helpers/utils/
* Move token-util to helpers/utils/
* Move /helpers/*.js inside /helpers/utils/
* Move util tests inside /helpers/utils/
* Renameand move confirm-transaction/util.js to helpers/utils/
* Move higher-order-components to helpers/higher-order-components/
* Move infura-conversion.json to helpers/constants/
* Move all utility functions to helpers/utils/
* Move pages directory to top-level
* Move all constants to helpers/constants/
* Move metametrics inside helpers/
* Move app and root inside pages/
* Move routes inside helpers/
* Re-organize ducks/
* Move reducers to ducks/
* Move selectors inside selectors/
* Move test out of test folder
* Move action, reducer, store inside store/
* Move ui components inside ui/
* Move UI components inside ui/
* Move connected components inside components/app/
* Move i18n-helper inside helpers/
* Fix unit tests
* Fix unit test
* Move pages components
* Rename routes component
* Move reducers to ducks/index
* Fix bad path in unit test
Diffstat (limited to 'ui/app/ducks/tests/send-duck.test.js')
-rw-r--r-- | ui/app/ducks/tests/send-duck.test.js | 186 |
1 files changed, 0 insertions, 186 deletions
diff --git a/ui/app/ducks/tests/send-duck.test.js b/ui/app/ducks/tests/send-duck.test.js deleted file mode 100644 index 43f51c631..000000000 --- a/ui/app/ducks/tests/send-duck.test.js +++ /dev/null @@ -1,186 +0,0 @@ -import assert from 'assert' - -import SendReducer, { - openToDropdown, - closeToDropdown, - updateSendErrors, - showGasButtonGroup, - hideGasButtonGroup, - updateSendWarnings, -} from '../send.duck.js' - -describe('Send Duck', () => { - const mockState = { - send: { - mockProp: 123, - }, - } - const initState = { - fromDropdownOpen: false, - toDropdownOpen: false, - errors: {}, - gasButtonGroupShown: true, - warnings: {}, - } - const OPEN_FROM_DROPDOWN = 'metamask/send/OPEN_FROM_DROPDOWN' - const CLOSE_FROM_DROPDOWN = 'metamask/send/CLOSE_FROM_DROPDOWN' - const OPEN_TO_DROPDOWN = 'metamask/send/OPEN_TO_DROPDOWN' - const CLOSE_TO_DROPDOWN = 'metamask/send/CLOSE_TO_DROPDOWN' - const UPDATE_SEND_ERRORS = 'metamask/send/UPDATE_SEND_ERRORS' - const UPDATE_SEND_WARNINGS = 'metamask/send/UPDATE_SEND_WARNINGS' - const RESET_SEND_STATE = 'metamask/send/RESET_SEND_STATE' - const SHOW_GAS_BUTTON_GROUP = 'metamask/send/SHOW_GAS_BUTTON_GROUP' - const HIDE_GAS_BUTTON_GROUP = 'metamask/send/HIDE_GAS_BUTTON_GROUP' - - describe('SendReducer()', () => { - it('should initialize state', () => { - assert.deepEqual( - SendReducer({}), - initState - ) - }) - - it('should return state unchanged if it does not match a dispatched actions type', () => { - assert.deepEqual( - SendReducer(mockState, { - type: 'someOtherAction', - value: 'someValue', - }), - Object.assign({}, mockState.send) - ) - }) - - it('should set fromDropdownOpen to true when receiving a OPEN_FROM_DROPDOWN action', () => { - assert.deepEqual( - SendReducer(mockState, { - type: OPEN_FROM_DROPDOWN, - }), - Object.assign({fromDropdownOpen: true}, mockState.send) - ) - }) - - it('should return a new object (and not just modify the existing state object)', () => { - assert.deepEqual(SendReducer(mockState), mockState.send) - assert.notEqual(SendReducer(mockState), mockState.send) - }) - - it('should set fromDropdownOpen to false when receiving a CLOSE_FROM_DROPDOWN action', () => { - assert.deepEqual( - SendReducer(mockState, { - type: CLOSE_FROM_DROPDOWN, - }), - Object.assign({fromDropdownOpen: false}, mockState.send) - ) - }) - - it('should set toDropdownOpen to true when receiving a OPEN_TO_DROPDOWN action', () => { - assert.deepEqual( - SendReducer(mockState, { - type: OPEN_TO_DROPDOWN, - }), - Object.assign({toDropdownOpen: true}, mockState.send) - ) - }) - - it('should set toDropdownOpen to false when receiving a CLOSE_TO_DROPDOWN action', () => { - assert.deepEqual( - SendReducer(mockState, { - type: CLOSE_TO_DROPDOWN, - }), - Object.assign({toDropdownOpen: false}, mockState.send) - ) - }) - - it('should set gasButtonGroupShown to true when receiving a SHOW_GAS_BUTTON_GROUP action', () => { - assert.deepEqual( - SendReducer(Object.assign({}, mockState, { gasButtonGroupShown: false }), { - type: SHOW_GAS_BUTTON_GROUP, - }), - Object.assign({gasButtonGroupShown: true}, mockState.send) - ) - }) - - it('should set gasButtonGroupShown to false when receiving a HIDE_GAS_BUTTON_GROUP action', () => { - assert.deepEqual( - SendReducer(mockState, { - type: HIDE_GAS_BUTTON_GROUP, - }), - Object.assign({gasButtonGroupShown: false}, mockState.send) - ) - }) - - it('should extend send.errors with the value of a UPDATE_SEND_ERRORS action', () => { - const modifiedMockState = Object.assign({}, mockState, { - send: { - errors: { - someError: false, - }, - }, - }) - assert.deepEqual( - SendReducer(modifiedMockState, { - type: UPDATE_SEND_ERRORS, - value: { someOtherError: true }, - }), - Object.assign({}, modifiedMockState.send, { - errors: { - someError: false, - someOtherError: true, - }, - }) - ) - }) - - it('should return the initial state in response to a RESET_SEND_STATE action', () => { - assert.deepEqual( - SendReducer(mockState, { - type: RESET_SEND_STATE, - }), - Object.assign({}, initState) - ) - }) - }) - - describe('openToDropdown', () => { - assert.deepEqual( - openToDropdown(), - { type: OPEN_TO_DROPDOWN } - ) - }) - - describe('closeToDropdown', () => { - assert.deepEqual( - closeToDropdown(), - { type: CLOSE_TO_DROPDOWN } - ) - }) - - describe('showGasButtonGroup', () => { - assert.deepEqual( - showGasButtonGroup(), - { type: SHOW_GAS_BUTTON_GROUP } - ) - }) - - describe('hideGasButtonGroup', () => { - assert.deepEqual( - hideGasButtonGroup(), - { type: HIDE_GAS_BUTTON_GROUP } - ) - }) - - describe('updateSendErrors', () => { - assert.deepEqual( - updateSendErrors('mockErrorObject'), - { type: UPDATE_SEND_ERRORS, value: 'mockErrorObject' } - ) - }) - - describe('updateSendWarnings', () => { - assert.deepEqual( - updateSendWarnings('mockWarningObject'), - { type: UPDATE_SEND_WARNINGS, value: 'mockWarningObject' } - ) - }) - -}) |