aboutsummaryrefslogtreecommitdiff
path: root/test/zendex/search_test.exs
blob: b2276b728f51c90eba80581bbe6f6b07d6acdbb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
defmodule Zendex.SearchTest do
  use ExUnit.Case, async: true

  alias Zendex.Connection

  setup do
    {:ok, conn: Connection.setup("http://test.zendesk.com", "User", "Passw")}
  end

  test "doing a search", %{conn: conn} do
    expected = ["Jimbob Ticket 1", "Jimbob Ticket 2"]

    actual = Zendex.Search.query(conn, %{type: "ticket", requester: "Jimbob"})

    assert actual == expected
  end

  test "doing a search with sorting", %{conn: conn} do
    expected = ["Reginald Ticket 1", "Reginald Ticket 2"]

    actual = Zendex.Search.query(conn,
                                 %{type: "ticket", requester: "Reginald"},
                                 "created_at",
                                 "desc")

    assert actual == expected
  end

end