mirror of
https://github.com/mgerb/classic-wow-forums
synced 2026-01-11 09:32:51 +00:00
server - repo associations figured out with thread/reply/user
This commit is contained in:
@@ -12,24 +12,24 @@ defmodule MyApp.Data.ThreadTest do
|
||||
}
|
||||
end
|
||||
|
||||
test "insert_thread: try to insert with no parameters" do
|
||||
assert insert_thread(%{}) == {:error,
|
||||
test "insert: try to insert with no parameters" do
|
||||
assert insert(%{}) == {:error,
|
||||
[%{title: "can't be blank"}, %{category_id: "can't be blank"},
|
||||
%{content: "can't be blank"}, %{user_id: "can't be blank"}]}
|
||||
end
|
||||
|
||||
test "insert_thread: insert as invalid user" do
|
||||
assert insert_thread(new_thread(9238748)) == {:error, [%{user_id: "does not exist"}]}
|
||||
test "insert: insert as invalid user" do
|
||||
assert insert(new_thread(9238748)) == {:error, [%{user_id: "does not exist"}]}
|
||||
end
|
||||
|
||||
test "insert_thread: insert as invalid category_id" do
|
||||
test "insert: insert as invalid category_id" do
|
||||
{:ok, user} = new_user()
|
||||
assert insert_thread(new_thread(user.id, 2342342343)) == {:error, [%{category_id: "does not exist"}]}
|
||||
assert insert(new_thread(user.id, 2342342343)) == {:error, [%{category_id: "does not exist"}]}
|
||||
end
|
||||
|
||||
test "new thread should be inserted" do
|
||||
{:ok, user} = new_user()
|
||||
{:ok, thread} = insert_thread(new_thread(user.id))
|
||||
{:ok, thread} = insert(new_thread(user.id))
|
||||
assert thread.title == "test title"
|
||||
assert thread.category_id == 1
|
||||
assert thread.user_id == user.id
|
||||
|
||||
Reference in New Issue
Block a user