diff --git a/test/short-urls/helpers/ShortUrlsRowMenu.test.js b/test/short-urls/helpers/ShortUrlsRowMenu.test.js
index 59d5f91e..cfcee90d 100644
--- a/test/short-urls/helpers/ShortUrlsRowMenu.test.js
+++ b/test/short-urls/helpers/ShortUrlsRowMenu.test.js
@@ -83,6 +83,4 @@ describe('', () => {
done();
});
});
-
- it('generates expected visits page link', () => {})
});
diff --git a/test/short-urls/helpers/VisitStatsLink.test.js b/test/short-urls/helpers/VisitStatsLink.test.js
new file mode 100644
index 00000000..dd7a2ec6
--- /dev/null
+++ b/test/short-urls/helpers/VisitStatsLink.test.js
@@ -0,0 +1,42 @@
+import React from 'react';
+import { shallow } from 'enzyme';
+import each from 'jest-each';
+import { Link } from 'react-router-dom';
+import VisitStatsLink from '../../../src/short-urls/helpers/VisitStatsLink';
+
+describe('', () => {
+ let wrapper;
+
+ afterEach(() => wrapper && wrapper.unmount());
+
+ each([
+ [ undefined, undefined ],
+ [ null, null ],
+ [{}, null ],
+ [{}, undefined ],
+ [ null, {}],
+ [ undefined, {}],
+ ]).it('only renders a plan span when either server or short URL are not set', (selectedServer, shortUrl) => {
+ wrapper = shallow(Something);
+ const link = wrapper.find(Link);
+
+ expect(link).toHaveLength(0);
+ expect(wrapper.html()).toEqual('Something');
+ });
+
+ each([
+ [{ id: '1' }, { shortCode: 'abc123' }, '/server/1/short-code/abc123/visits' ],
+ [
+ { id: '3' },
+ { shortCode: 'def456', domain: 'example.com' },
+ '/server/3/short-code/def456/visits?domain=example.com',
+ ],
+ ]).it('renders link with expected query when', (selectedServer, shortUrl, expectedLink) => {
+ wrapper = shallow(Something);
+ const link = wrapper.find(Link);
+ const to = link.prop('to');
+
+ expect(link).toHaveLength(1);
+ expect(to).toEqual(expectedLink);
+ });
+});