import * as React from 'react';
import * as ReactDOM from 'react-dom';
import * as sinon from 'sinon';
import test from 'ava';
import { shallow } from 'enzyme';
import Pagination from '../../../ts/views/widgets/pagination';
test(' will render right amount of buttons for <= 5 total pages ', (t) => {
// TODO: write actual test for this, haven't found the right approach yet
const firstWrapper = shallow(
{}}
/>);
const secondWrapper = shallow(
{}}
/>
);
const firstButtonAmount = firstWrapper.find('PageButton').length;
const secondButtonAmount = secondWrapper.find('PageButton').length;
t.is(firstButtonAmount, 5);
t.is(secondButtonAmount, 3);
});
test(' will render the correct amount of buttons when active page is 0 and total pages > 5', (t) => {
const wrapper = shallow(
{}}
/>
);
const buttonAmount = wrapper.find('PageButton').length;
t.is(buttonAmount, 4);
});
test(' will render correct # of buttons when activePage !== 0 && <= 3, and total pages > 5', (t) => {
const wrapper = shallow(
{}}
/>
);
const buttonAmount = wrapper.find('PageButton').length;
t.is(buttonAmount, 5);
});
test(' will render correct # of buttons if active page is last page', (t) => {
const wrapper = shallow(
{}}
/>
);
const buttonAmount = wrapper.find('PageButton').length;
t.is(buttonAmount, 5);
});
test(' renders corrent # of buttons when active page is not last page to 4th to last', (t) => {
const wrapper = shallow(
{}}
/>
);
const buttonAmount = wrapper.find('PageButton').length;
t.is(buttonAmount, 6);
});
test(' render correct # of buttons if active page is > 3 and < total pages minus 4', (t) => {
const wrapper = shallow(
{}}
/>
);
const buttonAmount = wrapper.find('PageButton').length;
t.is(buttonAmount, 5);
});