jtassin/react-amount-field

View on GitHub
src/__tests__/ReactAmountField.test.jsx

Summary

Maintainability
F
3 days
Test Coverage

Showing 8 of 8 total issues

Similar blocks of code found in 5 locations. Consider refactoring.
Open

it('treat , like .', (done) => {
const props = {
value: '215',
};
props[key] = (value) => {
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 4 other locations - About 5 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 76..90
src/__tests__/ReactAmountField.test.jsx on lines 108..122
src/__tests__/ReactAmountField.test.jsx on lines 124..138
src/__tests__/ReactAmountField.test.jsx on lines 140..154

Similar blocks of code found in 5 locations. Consider refactoring.
Open

it('when called on children transmit it to parent with value multiplied by 100', (done) => {
const props = {
value: '215',
};
props[key] = (value) => {
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 4 other locations - About 5 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 108..122
src/__tests__/ReactAmountField.test.jsx on lines 124..138
src/__tests__/ReactAmountField.test.jsx on lines 140..154
src/__tests__/ReactAmountField.test.jsx on lines 156..170

Similar blocks of code found in 5 locations. Consider refactoring.
Open

it('refuses more than 2 decimals', (done) => {
const props = {
value: '215',
};
props[key] = (value) => {
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 4 other locations - About 5 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 76..90
src/__tests__/ReactAmountField.test.jsx on lines 108..122
src/__tests__/ReactAmountField.test.jsx on lines 140..154
src/__tests__/ReactAmountField.test.jsx on lines 156..170

Similar blocks of code found in 5 locations. Consider refactoring.
Open

it('escape non digit chars', (done) => {
const props = {
value: '215',
};
props[key] = (value) => {
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 4 other locations - About 5 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 76..90
src/__tests__/ReactAmountField.test.jsx on lines 108..122
src/__tests__/ReactAmountField.test.jsx on lines 124..138
src/__tests__/ReactAmountField.test.jsx on lines 156..170

Similar blocks of code found in 5 locations. Consider refactoring.
Open

it('works with input type="text"', (done) => {
const props = {
value: '215',
};
props[key] = (value) => {
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 4 other locations - About 5 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 76..90
src/__tests__/ReactAmountField.test.jsx on lines 124..138
src/__tests__/ReactAmountField.test.jsx on lines 140..154
src/__tests__/ReactAmountField.test.jsx on lines 156..170

Similar blocks of code found in 2 locations. Consider refactoring.
Open

it('accept number value', () => {
const wrapper = shallow(
<ReactAmountField className="bar" value={1337}><span /></ReactAmountField>,
);
expect(wrapper.html()).to.equal('<div><span class="bar" value="13.37"></span></div>');
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 1 other location - About 2 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 51..56

Similar blocks of code found in 2 locations. Consider refactoring.
Open

it('handle value equals to 0 (integer)', () => {
const wrapper = shallow(
<ReactAmountField className="bar" value={0}><span /></ReactAmountField>,
);
expect(wrapper.html()).to.equal('<div><span class="bar" value="0"></span></div>');
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 1 other location - About 2 hrs to fix
src/__tests__/ReactAmountField.test.jsx on lines 30..35

Identical blocks of code found in 2 locations. Consider refactoring.
Open

beforeEach(() => {
const stub = sinon.stub(console, 'error');
stub.callsFake((warning) => { throw new Error(warning); });
});
Severity: Major
Found in src/__tests__/ReactAmountField.test.jsx and 1 other location - About 1 hr to fix
src/__tests__/ReduxFormMaterialUiWrapper.test.jsx on lines 22..25
Category
Status