Skip to content

Commit

Permalink
fix: Mix format. #252
Browse files Browse the repository at this point in the history
  • Loading branch information
LuchoTurtle committed Jan 10, 2023
1 parent 6b453c3 commit 1e93085
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
18 changes: 13 additions & 5 deletions test/app/item_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ defmodule App.ItemTest do
end

test "create_item/1 with valid data creates a item" do
assert {:ok, %{model: item, version: _version}} = Item.create_item(@valid_attrs)
assert {:ok, %{model: item, version: _version}} =
Item.create_item(@valid_attrs)

assert item.text == "some text"

Expand Down Expand Up @@ -46,16 +47,21 @@ defmodule App.ItemTest do
end

test "list_items/0 returns a list of items stored in the DB" do
{:ok, %{model: _item1, version: _version}} = Item.create_item(@valid_attrs)
{:ok, %{model: _item2, version: _version}} = Item.create_item(@valid_attrs)
{:ok, %{model: _item1, version: _version}} =
Item.create_item(@valid_attrs)

{:ok, %{model: _item2, version: _version}} =
Item.create_item(@valid_attrs)

assert Enum.count(Item.list_items()) == 2
end

test "update_item/2 with valid data updates the item" do
{:ok, %{model: item, version: _version}} = Item.create_item(@valid_attrs)

assert {:ok, %{model: item, version: _version}} = Item.update_item(item, @update_attrs)
assert {:ok, %{model: item, version: _version}} =
Item.update_item(item, @update_attrs)

assert item.text == "some updated text"
end
end
Expand All @@ -69,7 +75,9 @@ defmodule App.ItemTest do
}

test "get_item!/1 returns the item with given id" do
{:ok, %{model: item, version: _version}} = Item.create_item_with_tags(@valid_attrs)
{:ok, %{model: item, version: _version}} =
Item.create_item_with_tags(@valid_attrs)

assert length(item.tags) == 0
end
end
Expand Down
14 changes: 10 additions & 4 deletions test/app/timer_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ defmodule App.TimerTest do
@valid_item_attrs %{text: "some text", person_id: 1}

test "Timer.start/1 returns timer that has been started" do
{:ok, %{model: item, version: _version}} = Item.create_item(@valid_item_attrs)
{:ok, %{model: item, version: _version}} =
Item.create_item(@valid_item_attrs)

assert Item.get_item!(item.id).text == item.text

started = NaiveDateTime.utc_now()
Expand All @@ -20,7 +22,9 @@ defmodule App.TimerTest do
end

test "Timer.stop/1 stops the timer that had been started" do
{:ok, %{model: item, version: _version}} = Item.create_item(@valid_item_attrs)
{:ok, %{model: item, version: _version}} =
Item.create_item(@valid_item_attrs)

assert Item.get_item!(item.id).text == item.text

{:ok, started} =
Expand All @@ -37,7 +41,8 @@ defmodule App.TimerTest do
end

test "stop_timer_for_item_id(item_id) should stop the active timer (happy path)" do
{:ok, %{model: item, version: _version}} = Item.create_item(@valid_item_attrs)
{:ok, %{model: item, version: _version}} =
Item.create_item(@valid_item_attrs)

{:ok, seven_seconds_ago} =
NaiveDateTime.new(Date.utc_today(), Time.add(Time.utc_now(), -7))
Expand Down Expand Up @@ -72,7 +77,8 @@ defmodule App.TimerTest do
start = ~N[2022-10-27 00:00:00]
stop = ~N[2022-10-27 05:00:00]

{:ok, %{model: item, version: _version}} = Item.create_item(@valid_item_attrs)
{:ok, %{model: item, version: _version}} =
Item.create_item(@valid_item_attrs)

{:ok, seven_seconds_ago} =
NaiveDateTime.new(Date.utc_today(), Time.add(Time.utc_now(), -7))
Expand Down

0 comments on commit 1e93085

Please sign in to comment.