analytics/test/plausible_web/controllers/api/internal_controller_test.exs
2019-09-02 12:29:19 +01:00

24 lines
663 B
Elixir

defmodule PlausibleWeb.Api.InternalControllerTest do
use PlausibleWeb.ConnCase
use Plausible.Repo
import Plausible.TestUtils
describe "GET /:domain/status" do
setup [:create_user, :log_in, :create_site]
test "is WAITING when site has no pageviews", %{conn: conn, site: site} do
conn = get(conn, "/api/#{site.domain}/status")
assert json_response(conn, 200) == "WAITING"
end
test "is READY when site has at least 1 pageview", %{conn: conn, site: site} do
insert(:pageview, hostname: site.domain)
conn = get(conn, "/api/#{site.domain}/status")
assert json_response(conn, 200) == "READY"
end
end
end