diff --git a/client/src/__tests__/helpers.test.js b/client/src/__tests__/helpers.test.js index 309b40e6..a5ed121b 100644 --- a/client/src/__tests__/helpers.test.js +++ b/client/src/__tests__/helpers.test.js @@ -273,15 +273,15 @@ describe('sortIp', () => { }); }); describe('invalid input', () => { - const originalError = console.error; + const originalWarn = console.warn; beforeEach(() => { - console.error = jest.fn(); + console.warn = jest.fn(); }); afterEach(() => { - expect(console.error).toHaveBeenCalled(); - console.error = originalError; + expect(console.warn).toHaveBeenCalled(); + console.warn = originalWarn; }); test('invalid strings', () => { diff --git a/client/src/components/Filters/Rewrites/Table.js b/client/src/components/Filters/Rewrites/Table.js index 5bc1f678..45638ec0 100644 --- a/client/src/components/Filters/Rewrites/Table.js +++ b/client/src/components/Filters/Rewrites/Table.js @@ -2,6 +2,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import ReactTable from 'react-table'; import { withTranslation } from 'react-i18next'; +import { sortIp } from '../../../helpers/helpers'; class Table extends Component { cellWrap = ({ value }) => ( @@ -21,6 +22,7 @@ class Table extends Component { { Header: this.props.t('answer'), accessor: 'answer', + sortMethod: sortIp, Cell: this.cellWrap, }, { diff --git a/client/src/helpers/helpers.js b/client/src/helpers/helpers.js index 0ace3f08..0cefcfdf 100644 --- a/client/src/helpers/helpers.js +++ b/client/src/helpers/helpers.js @@ -687,7 +687,7 @@ export const sortIp = (a, b) => { return 0; } catch (e) { - console.error(e); + console.warn(e); return 0; } };