Skip to content

Commit

Permalink
client: 2353 sort ip in dns rewrites
Browse files Browse the repository at this point in the history
Close #2353

Squashed commit of the following:

commit 1072b12
Merge: 77e9a6f 6aacb21
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Tue Dec 8 14:27:06 2020 +0300

    Merge branch 'master' into 2353-fix-sort-ip

commit 77e9a6f
Author: Artem Baskal <a.baskal@adguard.com>
Date:   Mon Dec 7 17:38:24 2020 +0300

    client: 2353 sort ip in dns rewrites
  • Loading branch information
ArtemBaskal committed Dec 8, 2020
1 parent 6aacb21 commit b7bf7f7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions client/src/__tests__/helpers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 2 additions & 0 deletions client/src/components/Filters/Rewrites/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => (
Expand All @@ -21,6 +22,7 @@ class Table extends Component {
{
Header: this.props.t('answer'),
accessor: 'answer',
sortMethod: sortIp,
Cell: this.cellWrap,
},
{
Expand Down
2 changes: 1 addition & 1 deletion client/src/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ export const sortIp = (a, b) => {

return 0;
} catch (e) {
console.error(e);
console.warn(e);
return 0;
}
};
Expand Down

0 comments on commit b7bf7f7

Please sign in to comment.