Skip to content

Commit

Permalink
Merge pull request #38 from environment-agency-austria/feature/disabl…
Browse files Browse the repository at this point in the history
…e-console-error

Feature/disable console error
  • Loading branch information
maschino authored Apr 12, 2019
2 parents b6aaecb + bed654b commit 9f5592d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 17 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

## [2.0.4] - 2019-04-12
- Disabled `console.error` in `formatIntlString`

## [2.0.3] - 2018-12-16
- Migrated to rollup to improve package size and tree shaking

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-ocean-forms-react-intl",
"version": "2.0.3",
"version": "2.0.4",
"description": "Library that adds react-intl support to react-ocean-forms.",
"main": "build/index.js",
"module": "build/index.es.js",
Expand Down
14 changes: 0 additions & 14 deletions src/IntlForm/IntlForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,6 @@ describe('<IntlForm />', () => {
describe.each(cases)('called with "%s"', (name, value) => {
const { intl, formatIntlString } = setup();

let consoleErrorSpy: jest.SpyInstance;

beforeAll(() => {
consoleErrorSpy = jest.spyOn(console, 'error');
});

afterAll(() => {
consoleErrorSpy.mockClear();
});

it('should return the passed value as-is', () => {
const result = formatIntlString(value as string);
expect(result).toBe(value);
Expand All @@ -107,10 +97,6 @@ describe('<IntlForm />', () => {
it('should not call intl.formatMessage', () => {
expect(intl.formatMessage).not.toHaveBeenCalled();
});

it('should write an error on console.error', () => {
expect(consoleErrorSpy).toHaveBeenCalledWith('[IntlForm] Invalid id given to formatIntlString');
});
});
});
});
Expand Down
2 changes: 0 additions & 2 deletions src/IntlForm/IntlForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export class BaseIntlForm extends React.Component<IIntlFormProps> {
private formatIntlString = (id: string, values?: IMessageValues): string => {
// Return the id if no valid id was given
if (id === null || id === undefined || id === '') {
console.error('[IntlForm] Invalid id given to formatIntlString');

return id;
}

Expand Down

0 comments on commit 9f5592d

Please sign in to comment.