Skip to content

Commit

Permalink
Fix typo in enum ThousandGroupingStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesCoqueret committed Oct 18, 2021
1 parent be8078c commit c81ec0f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/Components/Amount.tsx
Expand Up @@ -6,7 +6,7 @@ import {
formatInputForDisplay,
formatInputForInput,
interpretValue,
ThousangGroupingStyle,
ThousandGroupingStyle,
} from '../utils/amount-formatter';

export interface FormattedValues {
Expand Down Expand Up @@ -37,7 +37,7 @@ export interface AmountProps {
/** Thousand separator (default: ',') */
thousandSeparator?: string;
/** Thousand style grouping (default: 'thousand') */
thousandGrouping?: ThousangGroupingStyle;
thousandGrouping?: ThousandGroupingStyle;
/** Value displayed on invalid input in textOnly (default: '-') */
displayOnInvalid?: string;
/** Test id */
Expand Down Expand Up @@ -244,7 +244,7 @@ Amount.defaultProps = {
required: false,
decimalSeparator: '.',
thousandSeparator: ',',
thousandGrouping: ThousangGroupingStyle.THOUSAND,
thousandGrouping: ThousandGroupingStyle.THOUSAND,
displayOnInvalid: '-',
dataTestId: undefined,
prefix: undefined,
Expand Down
10 changes: 5 additions & 5 deletions test/Components/Amount.spec.tsx
Expand Up @@ -3,7 +3,7 @@ import userEvent from '@testing-library/user-event';
import { render, screen } from '@testing-library/react';

import Amount, { AmountProps } from '../../src/Components/Amount';
import { ThousangGroupingStyle } from '../../src/utils/amount-formatter';
import { ThousandGroupingStyle } from '../../src/utils/amount-formatter';

const renderAmount = (props: Partial<AmountProps> = {}) => {
const defaultProps: AmountProps = {
Expand Down Expand Up @@ -86,7 +86,7 @@ describe('<Amount />', () => {
onChange,
decimalSeparator: ',',
thousandSeparator: ' ',
thousandGrouping: ThousangGroupingStyle.LAKH,
thousandGrouping: ThousandGroupingStyle.LAKH,
});

const inputField = screen.getByTestId('reactAmount');
Expand Down Expand Up @@ -135,7 +135,7 @@ describe('<Amount />', () => {
onChange,
decimalSeparator: ',',
thousandSeparator: ' ',
thousandGrouping: ThousangGroupingStyle.WAN,
thousandGrouping: ThousandGroupingStyle.WAN,
});

const inputField = screen.getByTestId('reactAmount');
Expand All @@ -157,7 +157,7 @@ describe('<Amount />', () => {
onChange,
decimalSeparator: ',',
thousandSeparator: ' ',
thousandGrouping: ThousangGroupingStyle.WAN,
thousandGrouping: ThousandGroupingStyle.WAN,
});

const inputField = screen.getByTestId('reactAmount');
Expand Down Expand Up @@ -187,7 +187,7 @@ describe('<Amount />', () => {
onChange,
decimalSeparator: ',',
thousandSeparator: ' ',
thousandGrouping: ThousangGroupingStyle.WAN,
thousandGrouping: ThousandGroupingStyle.WAN,
});

const inputField = screen.getByTestId('reactAmount');
Expand Down
4 changes: 2 additions & 2 deletions test/index.spec.ts
@@ -1,8 +1,8 @@
import { Amount, ThousangGroupingStyle } from '../src/index';
import { Amount, ThousandGroupingStyle } from '../src/index';

describe('index main export', () => {
test('should export all references', async () => {
expect(Amount).toBeTruthy();
expect(ThousangGroupingStyle).toBeTruthy();
expect(ThousandGroupingStyle).toBeTruthy();
});
});
20 changes: 10 additions & 10 deletions test/utils/amount-formatter.spec.ts
Expand Up @@ -7,7 +7,7 @@ import {
commonValidation,
interpretValue,
formatInputForDisplay,
ThousangGroupingStyle,
ThousandGroupingStyle,
formatInputForInput,
} from '../../src/utils/amount-formatter';

Expand Down Expand Up @@ -212,10 +212,10 @@ it('Basic formatting for display of positive values', () => {
expect(formatInputForDisplay(67_000, 5, ',', '.')).toEqual('67.000,00000');
expect(formatInputForDisplay(0.9, 0)).toEqual('0');
expect(
formatInputForDisplay(123_456_789, 5, ',', '.', ThousangGroupingStyle.WAN),
formatInputForDisplay(123_456_789, 5, ',', '.', ThousandGroupingStyle.WAN),
).toEqual('1.2345.6789,00000');
expect(
formatInputForDisplay(123_456_789, 5, ',', '.', ThousangGroupingStyle.LAKH),
formatInputForDisplay(123_456_789, 5, ',', '.', ThousandGroupingStyle.LAKH),
).toEqual('12.34.56.789,00000');
expect(formatInputForDisplay(11_223_344_556_677.123, 4, '.', '')).toEqual(
'11223344556677.1230',
Expand All @@ -237,15 +237,15 @@ it('Basic formatting for display of negative values', () => {
expect(formatInputForDisplay(-67_000, 5, ',', '.')).toEqual('-67.000,00000');
expect(formatInputForDisplay(-0.9, 0)).toEqual('0');
expect(
formatInputForDisplay(-123_456_789, 5, ',', '.', ThousangGroupingStyle.WAN),
formatInputForDisplay(-123_456_789, 5, ',', '.', ThousandGroupingStyle.WAN),
).toEqual('-1.2345.6789,00000');
expect(
formatInputForDisplay(
-123_456_789,
5,
',',
'.',
ThousangGroupingStyle.LAKH,
ThousandGroupingStyle.LAKH,
),
).toEqual('-12.34.56.789,00000');

Expand Down Expand Up @@ -288,7 +288,7 @@ it('Errornous formatting for display', () => {
5,
',',
'.',
ThousangGroupingStyle.THOUSAND,
ThousandGroupingStyle.THOUSAND,
'*',
),
).toEqual('*');
Expand All @@ -309,10 +309,10 @@ it('Basic formatting for input of positive values', () => {
expect(formatInputForInput(67_000, 5, ',', '.')).toEqual('67.000');
expect(formatInputForInput(0.9, 0)).toEqual('0');
expect(
formatInputForInput(123_456_789, 5, ',', '.', ThousangGroupingStyle.WAN),
formatInputForInput(123_456_789, 5, ',', '.', ThousandGroupingStyle.WAN),
).toEqual('1.2345.6789');
expect(
formatInputForInput(123_456_789, 5, ',', '.', ThousangGroupingStyle.LAKH),
formatInputForInput(123_456_789, 5, ',', '.', ThousandGroupingStyle.LAKH),
).toEqual('12.34.56.789');

// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
Expand All @@ -332,10 +332,10 @@ it('Basic formatting for input of negative values', () => {
expect(formatInputForInput(-67_000, 5, ',', '.')).toEqual('-67.000');
expect(formatInputForInput(-0.9, 0)).toEqual('-0');
expect(
formatInputForInput(-123_456_789, 5, ',', '.', ThousangGroupingStyle.WAN),
formatInputForInput(-123_456_789, 5, ',', '.', ThousandGroupingStyle.WAN),
).toEqual('-1.2345.6789');
expect(
formatInputForInput(-123_456_789, 5, ',', '.', ThousangGroupingStyle.LAKH),
formatInputForInput(-123_456_789, 5, ',', '.', ThousandGroupingStyle.LAKH),
).toEqual('-12.34.56.789');

// eslint-disable-next-line @typescript-eslint/no-loss-of-precision
Expand Down

0 comments on commit c81ec0f

Please sign in to comment.