Ensured visits amount card displays warning for old shlink versions

This commit is contained in:
Alejandro Celaya
2020-12-12 13:22:11 +01:00
parent 32957835b3
commit b9905c8bf4
3 changed files with 21 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
import { FC } from 'react';
import { shallow, ShallowWrapper } from 'enzyme';
import { Mock } from 'ts-mockery';
import { CardText } from 'reactstrap';
@@ -14,10 +15,11 @@ describe('<Overview />', () => {
let wrapper: ShallowWrapper;
const ShortUrlsTable = () => null;
const CreateShortUrl = () => null;
const ForServerVersion: FC = ({ children }) => <>{children}</>;
const listShortUrls = jest.fn();
const listTags = jest.fn();
const loadVisitsOverview = jest.fn();
const Overview = overviewCreator(ShortUrlsTable, CreateShortUrl);
const Overview = overviewCreator(ShortUrlsTable, CreateShortUrl, ForServerVersion);
const shortUrls = {
pagination: { totalItems: 83710 },
};
@@ -61,6 +63,13 @@ describe('<Overview />', () => {
expect(cards.at(2).html()).toContain(prettify(3));
});
test('first card displays warning for old shlink versions', () => {
const wrapper = createWrapper();
const firstCard = wrapper.find(CardText).first();
expect(firstCard.html()).toContain('Shlink 2.2 is needed');
});
test('nests complex components', () => {
const wrapper = createWrapper();