def test_show_next(): assert_true(search_helpers.pagination(101, 100,)["show_next"]) assert_true(search_helpers.pagination(101, 100, 1)["show_next"])
def test_should_show_prev_if_after_page_one(): assert_true(search_helpers.pagination(101, 100, 2)["show_prev"])
def test_should_show_prev_if_last_page(): assert_true(search_helpers.pagination(201, 100, 2)["show_prev"])
def test_should_hide_prev_if_page_one(): assert_false(search_helpers.pagination(101, 100)["show_prev"])
def test_set_total_pages(): assert_equal(search_helpers.pagination(99, 100)["total_pages"], 1) assert_equal(search_helpers.pagination(100, 100)["total_pages"], 1) assert_equal(search_helpers.pagination(101, 100)["total_pages"], 2)
def test_should_set_prev_page(): assert_equal(search_helpers.pagination(99, 100)["prev_page"], None) assert_equal(search_helpers.pagination(101, 100, 2)["prev_page"], 1) assert_equal(search_helpers.pagination(301, 100, 3)["prev_page"], 2) assert_equal(search_helpers.pagination(301, 100, 100)["prev_page"], 4)
def test_should_set_next_page(): assert_equal(search_helpers.pagination(99, 100)["next_page"], None) assert_equal(search_helpers.pagination(101, 100)["next_page"], 2) assert_equal(search_helpers.pagination(201, 100, 2)["next_page"], 3)
def test_hide_next_if_last_page(): assert_false(search_helpers.pagination(101, 100, 2)["show_next"])
def test_show_prev_as_last_page_if_too_big_page(): assert_true(search_helpers.pagination(101, 100, 20)["show_prev"])
def test_show_next(): assert_true(search_helpers.pagination( 101, 100, )["show_next"]) assert_true(search_helpers.pagination(101, 100, 1)["show_next"])
def test_should_hide_both_next_and_prev_if_no_services(): assert_false(search_helpers.pagination(0, 100)["show_prev"]) assert_false(search_helpers.pagination(0, 100)["show_next"])
def test_should_hide_both_next_and_prev_if_less_services_than_page(): assert_false(search_helpers.pagination(50, 100)["show_prev"]) assert_false(search_helpers.pagination(50, 100)["show_next"])