From 31175625b446cb5d18b17db23018bca8b14d280c Mon Sep 17 00:00:00 2001 From: Chi Kei Chan Date: Thu, 21 Mar 2019 16:03:30 -0700 Subject: 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 --- .../tests/send-dropdown-list-component.test.js | 105 --------------------- 1 file changed, 105 deletions(-) delete mode 100644 ui/app/components/send/send-content/send-dropdown-list/tests/send-dropdown-list-component.test.js (limited to 'ui/app/components/send/send-content/send-dropdown-list/tests') diff --git a/ui/app/components/send/send-content/send-dropdown-list/tests/send-dropdown-list-component.test.js b/ui/app/components/send/send-content/send-dropdown-list/tests/send-dropdown-list-component.test.js deleted file mode 100644 index b92dd4dfe..000000000 --- a/ui/app/components/send/send-content/send-dropdown-list/tests/send-dropdown-list-component.test.js +++ /dev/null @@ -1,105 +0,0 @@ -import React from 'react' -import assert from 'assert' -import { shallow } from 'enzyme' -import sinon from 'sinon' -import SendDropdownList from '../send-dropdown-list.component.js' - -import AccountListItem from '../../../account-list-item/account-list-item.container' - -const propsMethodSpies = { - closeDropdown: sinon.spy(), - onSelect: sinon.spy(), -} - -sinon.spy(SendDropdownList.prototype, 'getListItemIcon') - -describe('SendDropdownList Component', function () { - let wrapper - - beforeEach(() => { - wrapper = shallow(, { context: { t: str => str + '_t' } }) - }) - - afterEach(() => { - propsMethodSpies.closeDropdown.resetHistory() - propsMethodSpies.onSelect.resetHistory() - SendDropdownList.prototype.getListItemIcon.resetHistory() - }) - - describe('getListItemIcon', () => { - it('should return check icon if the passed addresses are the same', () => { - assert.deepEqual( - wrapper.instance().getListItemIcon('mockAccount0', 'mockAccount0'), - - ) - }) - - it('should return null if the passed addresses are different', () => { - assert.equal( - wrapper.instance().getListItemIcon('mockAccount0', 'mockAccount1'), - null - ) - }) - }) - - describe('render', () => { - it('should render a single div with two children', () => { - assert(wrapper.is('div')) - assert.equal(wrapper.children().length, 2) - }) - - it('should render the children with the correct classes', () => { - assert(wrapper.childAt(0).hasClass('send-v2__from-dropdown__close-area')) - assert(wrapper.childAt(1).hasClass('send-v2__from-dropdown__list')) - }) - - it('should call closeDropdown onClick of the send-v2__from-dropdown__close-area', () => { - assert.equal(propsMethodSpies.closeDropdown.callCount, 0) - wrapper.childAt(0).props().onClick() - assert.equal(propsMethodSpies.closeDropdown.callCount, 1) - }) - - it('should render an AccountListItem for each item in accounts', () => { - assert.equal(wrapper.childAt(1).children().length, 3) - assert(wrapper.childAt(1).children().every(AccountListItem)) - }) - - it('should pass the correct props to the AccountListItem', () => { - wrapper.childAt(1).children().forEach((accountListItem, index) => { - const { - account, - className, - handleClick, - } = accountListItem.props() - assert.deepEqual(account, { address: 'mockAccount' + index }) - assert.equal(className, 'account-list-item__dropdown') - assert.equal(propsMethodSpies.onSelect.callCount, 0) - handleClick() - assert.equal(propsMethodSpies.onSelect.callCount, 1) - assert.deepEqual(propsMethodSpies.onSelect.getCall(0).args[0], { address: 'mockAccount' + index }) - propsMethodSpies.onSelect.resetHistory() - propsMethodSpies.closeDropdown.resetHistory() - assert.equal(propsMethodSpies.closeDropdown.callCount, 0) - handleClick() - assert.equal(propsMethodSpies.closeDropdown.callCount, 1) - propsMethodSpies.onSelect.resetHistory() - propsMethodSpies.closeDropdown.resetHistory() - }) - }) - - it('should call this.getListItemIcon for each AccountListItem', () => { - assert.equal(SendDropdownList.prototype.getListItemIcon.callCount, 3) - const getListItemIconCalls = SendDropdownList.prototype.getListItemIcon.getCalls() - assert(getListItemIconCalls.every(({ args }, index) => args[0] === 'mockAccount' + index)) - }) - }) -}) -- cgit