Improve relationship UI handling (#42)
* Added tabbed view; improved relationships for media profile * Adds new maybe_limit method for queries * Improves UI for media items, associated tasks
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
defmodule Pinchflat.RepoTest do
|
||||
use Pinchflat.DataCase
|
||||
import Pinchflat.ProfilesFixtures
|
||||
|
||||
alias Pinchflat.Repo
|
||||
alias Pinchflat.Profiles.MediaProfile
|
||||
alias Pinchflat.JobFixtures.TestJobWorker
|
||||
|
||||
describe "insert_unique_job/1" do
|
||||
@@ -23,4 +26,30 @@ defmodule Pinchflat.RepoTest do
|
||||
assert {:error, _} = Pinchflat.Repo.insert_unique_job(%Ecto.Changeset{})
|
||||
end
|
||||
end
|
||||
|
||||
describe "maybe_limit/2" do
|
||||
test "applies a limit if provided" do
|
||||
media_profile_fixture()
|
||||
media_profile_fixture()
|
||||
|
||||
result =
|
||||
MediaProfile
|
||||
|> Repo.maybe_limit(1)
|
||||
|> Repo.aggregate(:count, :id)
|
||||
|
||||
assert result == 1
|
||||
end
|
||||
|
||||
test "does not apply a limit if not provided" do
|
||||
media_profile_fixture()
|
||||
media_profile_fixture()
|
||||
|
||||
result =
|
||||
MediaProfile
|
||||
|> Repo.maybe_limit(nil)
|
||||
|> Repo.aggregate(:count, :id)
|
||||
|
||||
assert result == 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user