mirror of
https://github.com/edgurgel/httparrot
synced 2025-04-05 08:12:31 -04:00
22 lines
535 B
Elixir
22 lines
535 B
Elixir
defmodule HTTParrot.UserAgentHandlerTest do
|
|
use ExUnit.Case
|
|
import :meck
|
|
import HTTParrot.UserAgentHandler
|
|
|
|
setup do
|
|
new :cowboy_req
|
|
new JSX
|
|
on_exit fn -> unload() end
|
|
:ok
|
|
end
|
|
|
|
test "returns prettified json with user agent" do
|
|
expect(:cowboy_req, :header, [{["user-agent", :req1, "null"], :user_agent}])
|
|
expect(JSX, :encode!, [{[[{"user-agent", :user_agent}]], :json}])
|
|
|
|
assert get_json(:req1, :state) == {:json, :req1, :state}
|
|
|
|
assert validate :cowboy_req
|
|
assert validate JSX
|
|
end
|
|
end
|