import React from 'react';
import { Link } from 'react-router';
import { shallow } from 'enzyme';
import { assert } from 'chai';
import Pagination from 'components/Pagination';
import styles from 'components/Pagination/pagination.scss';

describe('<Pagination />', () => {
  it('does not render without > 1 pages', () => {
    const wrapper = shallow(<Pagination totalPages={1} />);
    const actual = wrapper.hasClass(`${styles.root}`);
    const expected = false;

    assert.equal(actual, expected);
  });

  it('does render when > 1 pages', () => {
    const wrapper = shallow(<Pagination totalPages={4} />);
    const actual = wrapper.find(`.${styles.root}`).length;
    const expected = 1;

    assert.equal(actual, expected);
  });

  it('does not render "previous" link when on first page', () => {
    const wrapper = shallow(<Pagination totalPages={4} isFirstPage isLastPage={false} />);
    const actual = wrapper.find(Link).length;
    const expected = 1;

    assert.equal(actual, expected);
  });

  it('does not render "next" link when on last page', () => {
    const wrapper = shallow(<Pagination totalPages={4} isFirstPage={false} isLastPage />);
    const actual = wrapper.find(Link).props().rel;
    const expected = 'prev';

    assert.equal(actual, expected);
  });

  it('does not render "prev" link when on first page', () => {
    const wrapper = shallow(<Pagination totalPages={4} isFirstPage isLastPage={false} />);
    const actual = wrapper.find(Link).props().rel;
    const expected = 'next';

    assert.equal(actual, expected);
  });

  it('renders both "previous" and "next" links if not first or last page', () => {
    const wrapper = shallow(<Pagination totalPages={4} isLastPage={false} isFirstPage={false} />);
    const actual = wrapper.find(Link).length;
    const expected = 2;

    assert.equal(actual, expected);
  });
});

@@ -231,16 +231,96 @@
 scss';%0A%0A
+const params = %7B%0A  'page': 1,%0A  'city': '',%0A  'cityName': '',%0A  'limit': 12%0A%7D;%0A%0A
 describe
@@ -450,16 +450,32 @@
 ages=%7B1%7D
+ params=%7Bparams%7D
  /%3E);%0A  
@@ -696,16 +696,32 @@
 ages=%7B4%7D
+ params=%7Bparams%7D
  /%3E);%0A  
@@ -989,32 +989,48 @@
 LastPage=%7Bfalse%7D
+ params=%7Bparams%7D
  /%3E);%0A    const 
@@ -1280,16 +1280,32 @@
 LastPage
+ params=%7Bparams%7D
  /%3E);%0A  
@@ -1566,32 +1566,48 @@
 LastPage=%7Bfalse%7D
+ params=%7Bparams%7D
  /%3E);%0A    const 
@@ -1795,32 +1795,32 @@
  page', () =%3E %7B%0A
-
     const wrappe
@@ -1896,16 +1896,32 @@
 =%7Bfalse%7D
+ params=%7Bparams%7D
  /%3E);%0A  

Fix test since params are now required...