Tidy up test

This commit is contained in:
Adam Rutkowski 2025-12-15 15:49:01 +01:00
parent 7ba564b95d
commit a0ed4823bc
1 changed files with 6 additions and 6 deletions

View File

@ -108,7 +108,7 @@ defmodule PlausibleWeb.Plugins.API.Controllers.GoalsTest do
end end
describe "put /goals - create a single goal" do describe "put /goals - create a single goal" do
test "creates a custom event goal with custom_props", %{conn: conn, token: token, site: site} do test "creates a custom event goal with custom props", %{conn: conn, token: token, site: site} do
subscribe_to_business_plan(site.team) subscribe_to_business_plan(site.team)
url = Routes.plugins_api_goals_url(PlausibleWeb.Endpoint, :create) url = Routes.plugins_api_goals_url(PlausibleWeb.Endpoint, :create)
@ -152,7 +152,7 @@ defmodule PlausibleWeb.Plugins.API.Controllers.GoalsTest do
assert first_goal["goal"]["custom_props"] == %{"tier" => "premium", "source" => "landing"} assert first_goal["goal"]["custom_props"] == %{"tier" => "premium", "source" => "landing"}
end end
test "creates a custom event goal with empty custom_props by default", %{ test "fails to create goal with custom prop having invalid value", %{
conn: conn, conn: conn,
token: token, token: token,
site: site site: site
@ -177,7 +177,7 @@ defmodule PlausibleWeb.Plugins.API.Controllers.GoalsTest do
assert Enum.any?(resp.errors, &(&1.detail == "Invalid string. Got: integer")) assert Enum.any?(resp.errors, &(&1.detail == "Invalid string. Got: integer"))
end end
test "fails to create goal with more than 3 custom_props", %{ test "fails to create goal with more than 3 custom props", %{
conn: conn, conn: conn,
token: token, token: token,
site: site site: site
@ -208,7 +208,7 @@ defmodule PlausibleWeb.Plugins.API.Controllers.GoalsTest do
) )
end end
test "fails to create goal with null custom_props values", %{ test "fails to create goal with null custom props values", %{
conn: conn, conn: conn,
token: token, token: token,
site: site site: site
@ -234,7 +234,7 @@ defmodule PlausibleWeb.Plugins.API.Controllers.GoalsTest do
end end
@tag :ee_only @tag :ee_only
test "fails without Props feature when custom_props is non-empty", %{ test "fails without Props feature when custom props is non-empty", %{
conn: conn, conn: conn,
token: token, token: token,
site: site site: site
@ -722,7 +722,7 @@ defmodule PlausibleWeb.Plugins.API.Controllers.GoalsTest do
end end
describe "get /goals" do describe "get /goals" do
test "returns goals with custom_props in response", %{conn: conn, site: site, token: token} do test "returns goals with custom props in response", %{conn: conn, site: site, token: token} do
{:ok, _g1} = {:ok, _g1} =
Plausible.Goals.create(site, %{ Plausible.Goals.create(site, %{
"event_name" => "Signup", "event_name" => "Signup",