mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-02-27 04:06:39 +00:00
Minor changes on tags filtering for short URLs
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
import { shallow, ShallowWrapper } from 'enzyme';
|
||||
import { Mock } from 'ts-mockery';
|
||||
import shortUrlsCreator from '../../src/short-urls/ShortUrls';
|
||||
import { ShortUrlsListProps } from '../../src/short-urls/ShortUrlsList';
|
||||
|
||||
describe('<ShortUrls />', () => {
|
||||
let wrapper: ShallowWrapper;
|
||||
const SearchBar = () => null;
|
||||
const ShortUrlsList = () => null;
|
||||
|
||||
beforeEach(() => {
|
||||
const ShortUrls = shortUrlsCreator(SearchBar, ShortUrlsList);
|
||||
|
||||
wrapper = shallow(
|
||||
<ShortUrls {...Mock.all<ShortUrlsListProps>()} />,
|
||||
);
|
||||
});
|
||||
afterEach(() => wrapper.unmount());
|
||||
|
||||
it('wraps a SearchBar and ShortUrlsList', () => {
|
||||
expect(wrapper.find(SearchBar)).toHaveLength(1);
|
||||
expect(wrapper.find(ShortUrlsList)).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
@@ -30,8 +30,8 @@ describe('<TagCard />', () => {
|
||||
afterEach(jest.resetAllMocks);
|
||||
|
||||
it.each([
|
||||
[ 'ssr', '/server/1/list-short-urls/1?tag=ssr' ],
|
||||
[ 'ssr-&-foo', '/server/1/list-short-urls/1?tag=ssr-%26-foo' ],
|
||||
[ 'ssr', '/server/1/list-short-urls/1?tags=ssr' ],
|
||||
[ 'ssr-&-foo', '/server/1/list-short-urls/1?tags=ssr-%26-foo' ],
|
||||
])('shows a TagBullet and a link to the list filtering by the tag', (tag, expectedLink) => {
|
||||
const wrapper = createWrapper(tag);
|
||||
const links = wrapper.find(Link);
|
||||
@@ -61,7 +61,7 @@ describe('<TagCard />', () => {
|
||||
const links = wrapper.find(Link);
|
||||
|
||||
expect(links).toHaveLength(2);
|
||||
expect(links.at(0).prop('to')).toEqual('/server/1/list-short-urls/1?tag=ssr');
|
||||
expect(links.at(0).prop('to')).toEqual('/server/1/list-short-urls/1?tags=ssr');
|
||||
expect(links.at(0).text()).toContain('48');
|
||||
expect(links.at(1).prop('to')).toEqual('/server/1/tag/ssr/visits');
|
||||
expect(links.at(1).text()).toContain('23,257');
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('<TagsTableRow />', () => {
|
||||
const visitsLink = links.last();
|
||||
|
||||
expect(shortUrlsLink.prop('children')).toEqual(expectedShortUrls);
|
||||
expect(shortUrlsLink.prop('to')).toEqual(`/server/abc123/list-short-urls/1?tag=${encodeURIComponent('foo&bar')}`);
|
||||
expect(shortUrlsLink.prop('to')).toEqual(`/server/abc123/list-short-urls/1?tags=${encodeURIComponent('foo&bar')}`);
|
||||
expect(visitsLink.prop('children')).toEqual(expectedVisits);
|
||||
expect(visitsLink.prop('to')).toEqual('/server/abc123/tag/foo&bar/visits');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user