-
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eedd4f0
commit 7fa336f
Showing
1 changed file
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,27 @@ | ||
defmodule Plexus.PaginationHelpersTest do | ||
use ExUnit.Case, async: true | ||
doctest Plexus.PaginationHelpers | ||
|
||
alias Plexus.PaginationHelpers | ||
|
||
describe "page_opts/1" do | ||
test "with page and page_size" do | ||
assert [page: 9, page_size: 30] = PaginationHelpers.page_opts(%{page_size: 30, page: 9}) | ||
end | ||
|
||
test "with limit" do | ||
assert [page_size: 30] = PaginationHelpers.page_opts(%{limit: 30}) | ||
end | ||
|
||
test "with page only" do | ||
assert [page: 3] = PaginationHelpers.page_opts(%{page: 3}) | ||
end | ||
|
||
test "with empty map" do | ||
assert [] = PaginationHelpers.page_opts(%{}) | ||
end | ||
|
||
test "with non supported key/values" do | ||
assert [] = PaginationHelpers.page_opts(%{bogus: :value}) | ||
end | ||
end | ||
end |