Skip to content

Commit a13954c

Browse files
committed
Add default number value for formatting numbers and fix all failed tests
1 parent 9ee894e commit a13954c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/components/CostDisplay/CostDisplay.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ describe('<CostDisplay />', () => {
77
test('it should mount', () => {
88
render(<CostDisplay />);
99

10-
const CostDisplay = screen.getByTestId('CostDisplay');
10+
const costDisplay = screen.getByTestId('CostDisplay');
1111

12-
expect(CostDisplay).toBeInTheDocument();
12+
expect(costDisplay).toBeInTheDocument();
1313
});
1414
});

src/components/NumericDisplay/NumericDisplay.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import styles from './NumericDisplay.module.css';
44

5-
function formatNumber(number, shortForm = true) {
5+
function formatNumber(number = 0, shortForm = true) {
66
//format number to short form with numeric prefixes
77
if (shortForm) {
88
//if short form is true

src/components/NumericDisplay/NumericDisplay.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ describe('<NumericDisplay />', () => {
77
test('it should mount', () => {
88
render(<NumericDisplay />);
99

10-
const NumericDisplay = screen.getByTestId('NumericDisplay');
10+
const numericDisplay = screen.getByTestId('NumericDisplay');
1111

12-
expect(NumericDisplay).toBeInTheDocument();
12+
expect(numericDisplay).toBeInTheDocument();
1313
});
14-
});
14+
});

0 commit comments

Comments
 (0)