-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate from status id to status_code ref: dwyl/statuses#4 #89
- Loading branch information
Showing
16 changed files
with
192 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
defmodule App.PersonTest do | ||
use App.DataCase | ||
alias App.Person | ||
|
||
describe "person/people" do | ||
# test "get!/1 returns the person with given id" do | ||
# person = item_fixture(@valid_attrs) | ||
# assert Item.get_item!(item.id) == item | ||
# end | ||
|
||
test "create/1 with valid data creates a person" do | ||
person = Person.create(%{ | ||
givenName: "aLeX", | ||
auth_provider: "dwyl", | ||
status_code: 1, | ||
local: "SoCal" | ||
}) | ||
assert person.givenName == "aLeX" | ||
assert person.status_code == 1 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
defmodule App.StatusTest do | ||
use App.DataCase | ||
alias App.Status | ||
|
||
describe "status" do | ||
@valid_attrs %{text: "some text"} | ||
# @update_attrs %{text: "some updated text"} | ||
@invalid_attrs %{text: nil} | ||
|
||
|
||
def status_fixture(attrs \\ %{}) do | ||
{:ok, status} = | ||
attrs | ||
|> Enum.into(@valid_attrs) | ||
|> Status.create() | ||
|
||
status | ||
end | ||
|
||
test "create/1 with valid data creates a status" do | ||
{:ok, status} = Status.create(@valid_attrs) | ||
assert status.text == "some text" | ||
end | ||
|
||
test "create/1 with invalid data returns error changeset" do | ||
assert {:error, %Ecto.Changeset{}} = Status.create(@invalid_attrs) | ||
end | ||
|
||
test "upsert/1 with valid data returns status" do | ||
{:ok, status} = Status.upsert(@valid_attrs) | ||
assert status.text == "some text" | ||
|
||
# confirm that upsert/1 does not re-create the same status: | ||
{:ok, status_again} = Status.upsert(@valid_attrs) | ||
assert status_again.id == status.id | ||
end | ||
|
||
|
||
test "upsert/1 with new data returns the new status" do | ||
new_status = %{text: "Hello Simon!"} | ||
{:ok, status} = Status.upsert(new_status) | ||
assert status.text == new_status.text | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
defmodule App.TimerTest do | ||
use App.DataCase | ||
alias App.{Item, Timer} | ||
|
||
describe "timers" do | ||
@valid_item_attrs %{text: "some text", person_id: 1} | ||
# @update_attrs %{text: "some updated text", status: 1} | ||
# @invalid_attrs %{text: nil} | ||
|
||
|
||
def item_fixture(attrs \\ %{}) do | ||
{:ok, item} = | ||
attrs | ||
|> Enum.into(@valid_item_attrs) | ||
|> Item.create_item() | ||
|
||
item | ||
end | ||
|
||
test "Timer.start!/1 returns timer that has been started" do | ||
item = item_fixture(@valid_item_attrs) | ||
assert Item.get_item!(item.id) == item | ||
|
||
started = NaiveDateTime.utc_now | ||
{:ok, timer} = Timer.start(%{item_id: item.id, person_id: 1, start: started}) | ||
assert NaiveDateTime.diff(timer.start, started) == 0 | ||
end | ||
end | ||
end |
Oops, something went wrong.