Skip to content

Commit

Permalink
Removed Test from CI-pipe for now. Thinking starting over.
Browse files Browse the repository at this point in the history
  • Loading branch information
Juha Halmu committed Sep 18, 2024
1 parent d414391 commit 29e21b5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Apps: Auth, Posts

## Diary

18.9.2024

I removed basic Test from CI-pipe to be happier. Waiting for Godot. I think too, that if I should start over. Actually I haven't got very far from start. I have played here. Have had links and so on.

9.9.2024

I practised with Andrew Steward's " How you start writing LiveView " video where he makes Link app allmost from scratch. I did the Links.
Expand Down
18 changes: 15 additions & 3 deletions test/kotisivut/blog_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ defmodule Kotisivut.BlogTest do

import Kotisivut.BlogFixtures

@invalid_attrs %{title: nil, body: nil}
@invalid_attrs %{status: nil, title: nil, body: nil}

test "list_posts/0 returns all posts" do
post = post_fixture()
Expand All @@ -21,9 +21,11 @@ defmodule Kotisivut.BlogTest do
end

test "create_post/1 with valid data creates a post" do
valid_attrs = %{title: "some title", body: "some body"}
valid_attrs = %{user_id: 1, status: "some status", title: "some title", body: "some body"}

assert {:ok, %Post{} = post} = Blog.create_post(valid_attrs)
assert post.user_id == 1
assert post.status == "some status"
assert post.title == "some title"
assert post.body == "some body"
end
Expand All @@ -34,9 +36,19 @@ defmodule Kotisivut.BlogTest do

test "update_post/2 with valid data updates the post" do
post = post_fixture()
update_attrs = %{title: "some updated title", body: "some updated body"}

update_attrs = %{
user_id: 1,
status: "Some up status",
title: "some updated title",
body: "some updated body"
}

assert {:ok, %Post{} = post} = Blog.update_post(post, update_attrs)

assert post.user_id == 1,
assert(post.status == "some up status")

assert post.title == "some updated title"
assert post.body == "some updated body"
end
Expand Down
9 changes: 7 additions & 2 deletions test/kotisivut_web/live/post_live_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ defmodule KotisivutWeb.PostLiveTest do
import Phoenix.LiveViewTest
import Kotisivut.BlogFixtures

@create_attrs %{title: "some title", body: "some body"}
@update_attrs %{title: "some updated title", body: "some updated body"}
@create_attrs %{user_id: 1, status: "some status", title: "some title", body: "some body"}
@update_attrs %{
status: "some up status",
title: "some updated title",
body: "some updated body",
user_id: 1
}
@invalid_attrs %{title: nil, body: nil}

defp create_post(_) do
Expand Down
3 changes: 3 additions & 0 deletions test/support/fixtures/accounts_fixtures.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ defmodule Kotisivut.AccountsFixtures do

def valid_user_attributes(attrs \\ %{}) do
Enum.into(attrs, %{
username: "jussipussi",
fullname: "jussi pussi",
role: true,
email: unique_user_email(),
password: valid_user_password()
})
Expand Down
2 changes: 2 additions & 0 deletions test/support/fixtures/blog_fixtures.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ defmodule Kotisivut.BlogFixtures do
{:ok, post} =
attrs
|> Enum.into(%{
user_id: 1,
status: "some status",
body: "some body",
title: "some title"
})
Expand Down

0 comments on commit 29e21b5

Please sign in to comment.