This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #954 from LiskHQ/703-unit-tests
Remove direct calls to methods of components in unit tests - Closes #703
- Loading branch information
Showing
14 changed files
with
299 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import { expect } from 'chai'; | ||
import { mount } from 'enzyme'; | ||
import FormattedNumber from './index'; | ||
import i18n from '../../i18n'; | ||
|
||
|
||
describe('FormattedNumber', () => { | ||
const options = { | ||
context: { i18n }, | ||
childContextTypes: { | ||
i18n: PropTypes.object.isRequired, | ||
}, | ||
}; | ||
|
||
it('renders 0 if raw value is 0', () => { | ||
const value = { | ||
raw: 0, | ||
formatted: '0', | ||
}; | ||
const wrapper = mount(<FormattedNumber val={value.raw} />, options); | ||
expect(wrapper.find('span').text()).to.equal(value.formatted); | ||
}); | ||
|
||
it('renders 1,000 if raw value is 1000', () => { | ||
const value = { | ||
raw: 1234, | ||
formatted: '1,234', | ||
}; | ||
const wrapper = mount(<FormattedNumber val={value.raw} />, options); | ||
expect(wrapper.find('span').text()).to.equal(value.formatted); | ||
}); | ||
|
||
it('renders 1,000.95 if raw value is 1000', () => { | ||
const value = { | ||
raw: 1234.56, | ||
formatted: '1,234.56', | ||
}; | ||
const wrapper = mount(<FormattedNumber val={value.raw} />, options); | ||
expect(wrapper.find('span').text()).to.equal(value.formatted); | ||
}); | ||
|
||
it('renders 10.01 if raw value is 10.01', () => { | ||
const value = { | ||
raw: 123.45, | ||
formatted: '123.45', | ||
}; | ||
const wrapper = mount(<FormattedNumber val={value.raw} />, options); | ||
expect(wrapper.find('span').text()).to.equal(value.formatted); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.