mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
SendRowErrorMessage component test.
This commit is contained in:
parent
22e2806ae2
commit
5d79d12648
@ -0,0 +1,28 @@
|
||||
import React from 'react'
|
||||
import assert from 'assert'
|
||||
import { shallow } from 'enzyme'
|
||||
import SendRowErrorMessage from '../send-row-error-message.component.js'
|
||||
|
||||
describe('SendRowErrorMessage Component', function () {
|
||||
let wrapper
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = shallow(<SendRowErrorMessage
|
||||
errors={{ error1: 'abc', error2: 'def' }}
|
||||
errorType={'error3'}
|
||||
/>, { context: { t: str => str + '_t' } })
|
||||
})
|
||||
|
||||
describe('render', () => {
|
||||
it('should render null if the passed errors do not contain an error of errorType', () => {
|
||||
assert.equal(wrapper.find('.send-v2__error').length, 0)
|
||||
assert.equal(wrapper.html(), null)
|
||||
})
|
||||
|
||||
it('should render an error message if the passed errors contain an error of errorType', () => {
|
||||
wrapper.setProps({ errors: { error1: 'abc', error2: 'def', error3: 'xyz' } })
|
||||
assert.equal(wrapper.find('.send-v2__error').length, 1)
|
||||
assert.equal(wrapper.find('.send-v2__error').text(), 'xyz_t')
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue
Block a user