diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/index.spec.js b/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/index.spec.js new file mode 100644 index 00000000000..7cf85bbcb94 --- /dev/null +++ b/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/index.spec.js @@ -0,0 +1,45 @@ +import React from 'react' +import { TestBed, getDispatchSpyReducer, createTestStore } from 'utils/testbed' +import { mount } from 'enzyme' +import { combineReducers } from 'redux' + +// import { actions } from 'data' +import { coreReducers, paths } from 'blockchain-wallet-v4/src' +import modalsReducer from 'data/modals/reducers' + +import AcceptTerms from './index' + +const { dispatchSpy, spyReducer } = getDispatchSpyReducer() + +describe('Coinify AcceptTerms Modal', () => { + beforeEach(() => { + dispatchSpy.mockClear() + }) + const reducers = { + spy: spyReducer, + modals: modalsReducer, + components: combineReducers({}), + [paths.settingsPath]: coreReducers.settings + } + let store + let wrapper + beforeEach(() => { + store = createTestStore(reducers) + wrapper = mount( + + + + ) + }) + + describe('modal rendering', () => { + it('should render', () => { + expect(wrapper.find('Field[name="terms"]')).toHaveLength(1) + }) + + it('should should be disabled with terms not clicked', () => { + expect(wrapper.find('Field[name="terms"]').find('input').props().checked).toBe(false) + expect(wrapper.find('button').props().disabled).toBe(true) + }) + }) +}) diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/template.js b/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/template.js index e3aebf3c458..d94540a4887 100644 --- a/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/template.js +++ b/packages/blockchain-wallet-v4-frontend/src/modals/CoinifyExchangeData/Create/AcceptTerms/template.js @@ -29,6 +29,8 @@ import { import { prop } from 'ramda' import media from 'services/ResponsiveService' +export const EMAIL_IN_USE_ERROR = 'email_address_and_partner_id_in_use' + const AcceptTermsContainer = styled.div` display: flex; flex-direction: row; @@ -200,8 +202,7 @@ const AcceptTerms = props => { - {signupError && - prop('error', signupError) === 'email_address_in_use' ? ( + {signupError && prop('error', signupError) === EMAIL_IN_USE_ERROR ? ( { defaultMessage='contact support.' /> +
+ + +
) : null}