84159a1c0d
Files Created (8 files, 54 new tests) Fixtures 1. test/support/fixtures/music_library/record_sets.ex — record_set/1 and record_set_with_records/2 helpers 2. test/support/fixtures/music_library/online_store_templates.ex — online_store_template/1 helper Context Tests 3. test/music_library/record_sets_test.exs — 20 tests covering search, count, CRUD, add/remove/move records 4. test/music_library/online_store_templates_test.exs — 8 tests covering list, CRUD, URL generation, validation 5. test/music_library/search_test.exs — 5 tests covering universal search and search counts 6. test/music_library/notes_test.exs — 4 tests covering get, create, update LiveView Tests 7. test/music_library_web/live/record_set_live/index_test.exs — 11 tests covering listing, empty state, search, ordering, create/edit/delete sets, remove records, reorder records 8. test/music_library_web/live/online_store_template_live/index_test.exs — 6 tests covering listing, create/edit/delete, toggle enabled Results - 297 tests, 0 failures (up from 243 — 54 new tests added) - All existing tests continue to pass There's a remaining gettext warning that needs to be investigated
57 lines
1.5 KiB
Elixir
57 lines
1.5 KiB
Elixir
defmodule MusicLibrary.NotesTest do
|
|
use MusicLibrary.DataCase
|
|
|
|
alias MusicLibrary.Notes
|
|
alias MusicLibrary.Notes.Note
|
|
|
|
@musicbrainz_id Ecto.UUID.generate()
|
|
|
|
describe "get_note/2" do
|
|
test "returns nil when no note exists" do
|
|
assert Notes.get_note(:record, Ecto.UUID.generate()) == nil
|
|
end
|
|
|
|
test "returns note for record" do
|
|
{:ok, note} =
|
|
Notes.create_note(%Note{}, %{
|
|
entity: :record,
|
|
musicbrainz_id: @musicbrainz_id,
|
|
content: "Great album"
|
|
})
|
|
|
|
found = Notes.get_note(:record, @musicbrainz_id)
|
|
assert found.id == note.id
|
|
assert found.content == "Great album"
|
|
end
|
|
end
|
|
|
|
describe "create_note/2" do
|
|
test "creates a note" do
|
|
assert {:ok, note} =
|
|
Notes.create_note(%Note{}, %{
|
|
entity: :artist,
|
|
musicbrainz_id: @musicbrainz_id,
|
|
content: "Fantastic artist"
|
|
})
|
|
|
|
assert note.entity == :artist
|
|
assert note.content == "Fantastic artist"
|
|
assert note.musicbrainz_id == @musicbrainz_id
|
|
end
|
|
end
|
|
|
|
describe "update_note/2" do
|
|
test "updates note content" do
|
|
{:ok, note} =
|
|
Notes.create_note(%Note{}, %{
|
|
entity: :record,
|
|
musicbrainz_id: @musicbrainz_id,
|
|
content: "Original"
|
|
})
|
|
|
|
assert {:ok, updated} = Notes.update_note(note, %{content: "Updated content"})
|
|
assert updated.content == "Updated content"
|
|
end
|
|
end
|
|
end
|