From e87973c5e5c3c2091a1bf2b69f5adf40f48ffde7 Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Tue, 26 Oct 2021 00:23:31 -0600 Subject: [PATCH] Add basic router test Obviously going to be expanded upon by quite a bit, but just wanted to get started with basic testing sooner rather than later. --- mix.exs | 2 +- test/privacy_revolver_test.exs | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mix.exs b/mix.exs index 7c1c723..8adbae8 100644 --- a/mix.exs +++ b/mix.exs @@ -1,4 +1,4 @@ -defmodule RouterExample.MixProject do +defmodule PrivacyRevolver.MixProject do use Mix.Project def project do diff --git a/test/privacy_revolver_test.exs b/test/privacy_revolver_test.exs index aa8fa79..8c85530 100644 --- a/test/privacy_revolver_test.exs +++ b/test/privacy_revolver_test.exs @@ -1,8 +1,18 @@ defmodule PrivacyRevolverTest do use ExUnit.Case - doctest PrivacyRevolver + use Plug.Test - test "greets the world" do - assert PrivacyRevolver.hello() == :world + alias PrivacyRevolver.Router + + @opts Router.init([]) + + test "/" do + conn = + :get + |> conn("/", "") + |> Router.call(@opts) + + assert conn.state == :sent + assert conn.status == 200 end end