mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-02-27 04:06:39 +00:00
Added not-enabled sorting on tags table
This commit is contained in:
@@ -2,7 +2,6 @@ import { Mock } from 'ts-mockery';
|
||||
import { shallow, ShallowWrapper } from 'enzyme';
|
||||
import { match } from 'react-router';
|
||||
import { Location, History } from 'history';
|
||||
import ColorGenerator from '../../src/utils/services/ColorGenerator';
|
||||
import { TagsTable as createTagsTable } from '../../src/tags/TagsTable';
|
||||
import { SelectedServer } from '../../src/servers/data';
|
||||
import { TagsList } from '../../src/tags/reducers/tagsList';
|
||||
@@ -10,9 +9,8 @@ import { rangeOf } from '../../src/utils/utils';
|
||||
import SimplePaginator from '../../src/common/SimplePaginator';
|
||||
|
||||
describe('<TagsTable />', () => {
|
||||
const colorGenerator = Mock.all<ColorGenerator>();
|
||||
const TagsTableRow = () => null;
|
||||
const TagsTable = createTagsTable(colorGenerator, TagsTableRow);
|
||||
const TagsTable = createTagsTable(TagsTableRow);
|
||||
const tags = (amount: number) => rangeOf(amount, (i) => `tag_${i}`);
|
||||
let wrapper: ShallowWrapper;
|
||||
const createWrapper = (filteredTags: string[] = [], search = '') => {
|
||||
@@ -86,7 +84,7 @@ describe('<TagsTable />', () => {
|
||||
|
||||
expect(tagRows).toHaveLength(expectedRows);
|
||||
tagRows.forEach((row, index) => {
|
||||
expect(row.prop('tag')).toEqual(`tag_${index + offset + 1}`);
|
||||
expect(row.prop('tag')).toEqual(expect.objectContaining({ tag: `tag_${index + offset + 1}` }));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -5,21 +5,18 @@ import { DropdownItem } from 'reactstrap';
|
||||
import { TagsTableRow as createTagsTableRow } from '../../src/tags/TagsTableRow';
|
||||
import { ReachableServer } from '../../src/servers/data';
|
||||
import ColorGenerator from '../../src/utils/services/ColorGenerator';
|
||||
import { TagStats } from '../../src/tags/data';
|
||||
import { DropdownBtnMenu } from '../../src/utils/DropdownBtnMenu';
|
||||
|
||||
describe('<TagsTableRow />', () => {
|
||||
const DeleteTagConfirmModal = () => null;
|
||||
const EditTagModal = () => null;
|
||||
const TagsTableRow = createTagsTableRow(DeleteTagConfirmModal, EditTagModal);
|
||||
const TagsTableRow = createTagsTableRow(DeleteTagConfirmModal, EditTagModal, Mock.all<ColorGenerator>());
|
||||
let wrapper: ShallowWrapper;
|
||||
const createWrapper = (tagStats?: TagStats) => {
|
||||
const createWrapper = (tagStats?: { visits?: number; shortUrls?: number }) => {
|
||||
wrapper = shallow(
|
||||
<TagsTableRow
|
||||
tag="foo&bar"
|
||||
tagStats={tagStats}
|
||||
tag={{ tag: 'foo&bar', visits: tagStats?.visits ?? 0, shortUrls: tagStats?.shortUrls ?? 0 }}
|
||||
selectedServer={Mock.of<ReachableServer>({ id: 'abc123' })}
|
||||
colorGenerator={Mock.all<ColorGenerator>()}
|
||||
/>,
|
||||
);
|
||||
|
||||
@@ -30,7 +27,7 @@ describe('<TagsTableRow />', () => {
|
||||
|
||||
it.each([
|
||||
[ undefined, '0', '0' ],
|
||||
[ Mock.of<TagStats>({ shortUrlsCount: 10, visitsCount: 3480 }), '10', '3,480' ],
|
||||
[{ shortUrls: 10, visits: 3480 }, '10', '3,480' ],
|
||||
])('shows expected tag stats', (stats, expectedShortUrls, expectedVisits) => {
|
||||
const wrapper = createWrapper(stats);
|
||||
const links = wrapper.find(Link);
|
||||
|
||||
@@ -4,7 +4,7 @@ import { identity, values } from 'ramda';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faSortAmountDown as caretDownIcon } from '@fortawesome/free-solid-svg-icons';
|
||||
import SortingDropdown, { SortingDropdownProps } from '../../src/utils/SortingDropdown';
|
||||
import { OrderDir } from '../../src/utils/utils';
|
||||
import { OrderDir } from '../../src/utils/helpers/ordering';
|
||||
|
||||
describe('<SortingDropdown />', () => {
|
||||
let wrapper: ShallowWrapper;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { capitalize, determineOrderDir, nonEmptyValueOrNull, rangeOf } from '../../src/utils/utils';
|
||||
import { capitalize, nonEmptyValueOrNull, rangeOf } from '../../src/utils/utils';
|
||||
import { determineOrderDir } from '../../src/utils/helpers/ordering';
|
||||
|
||||
describe('utils', () => {
|
||||
describe('determineOrderDir', () => {
|
||||
|
||||
@@ -2,7 +2,8 @@ import { shallow, ShallowWrapper } from 'enzyme';
|
||||
import { range } from 'ramda';
|
||||
import SortingDropdown from '../../../src/utils/SortingDropdown';
|
||||
import PaginationDropdown from '../../../src/utils/PaginationDropdown';
|
||||
import { OrderDir, rangeOf } from '../../../src/utils/utils';
|
||||
import { rangeOf } from '../../../src/utils/utils';
|
||||
import { OrderDir } from '../../../src/utils/helpers/ordering';
|
||||
import { Stats } from '../../../src/visits/types';
|
||||
import { SortableBarChartCard } from '../../../src/visits/charts/SortableBarChartCard';
|
||||
import { HorizontalBarChart } from '../../../src/visits/charts/HorizontalBarChart';
|
||||
|
||||
Reference in New Issue
Block a user