Skip to content

Commit 5f9d1cf

Browse files
committed
feat: Adding tests to CheckoutSessionController. #1
1 parent 4b62332 commit 5f9d1cf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
defmodule AppWeb.CheckoutSessionControllerTest do
2+
use AppWeb.ConnCase
3+
import App.ConnFixtures
4+
5+
import Mock
6+
7+
test "get redirection to stripe checkout session with loggedin user", %{conn: conn} do
8+
conn = setup_conn_with_user(conn)
9+
url_to_be_redirected_to = "www.session_url.com"
10+
11+
with_mock Stripe.Session, [create: fn(_params) -> {:ok, %{url: url_to_be_redirected_to}} end] do
12+
13+
conn = post(conn, ~p"/purchase/checkout-session", %{})
14+
15+
assert redirected_to(conn, 303) == url_to_be_redirected_to
16+
end
17+
end
18+
end

0 commit comments

Comments
 (0)