Migrated all remaining short-url elements to TS

This commit is contained in:
Alejandro Celaya
2020-08-30 19:45:17 +02:00
parent 4b33d39d44
commit 8a9c694fbc
24 changed files with 555 additions and 595 deletions

View File

@@ -0,0 +1,28 @@
import React from 'react';
import { shallow, ShallowWrapper } from 'enzyme';
import { PaginationItem } from 'reactstrap';
import Paginator from '../../src/short-urls/Paginator';
describe('<Paginator />', () => {
let wrapper: ShallowWrapper;
afterEach(() => wrapper?.unmount());
it('renders nothing if the number of pages is below 2', () => {
wrapper = shallow(<Paginator serverId="abc123" />);
expect(wrapper.text()).toEqual('');
});
it('renders previous, next and the list of pages', () => {
const paginator = {
currentPage: 1,
pagesCount: 5,
};
const extraPagesPrevNext = 2;
const expectedItems = paginator.pagesCount + extraPagesPrevNext;
wrapper = shallow(<Paginator serverId="abc123" paginator={paginator} />);
expect(wrapper.find(PaginationItem)).toHaveLength(expectedItems);
});
});