Add test to verify that musicbrainz_data gets stored

This commit is contained in:
Claudio Ortolina
2024-10-07 08:39:22 +01:00
parent 11a8149bcc
commit 2e950325cb
@@ -208,84 +208,84 @@ defmodule MusicLibraryWeb.RecordIndexTest do
first_result = hd(mock_results)
first_result_id = first_result.id
expect(APIBehaviourMock, :get_release_group, fn ^first_result_id ->
release_group = %{
"artist-credit" => [
%{
"artist" => %{
"disambiguation" => "British progressive rock band",
"genres" => [
%{
"count" => 10,
"disambiguation" => "",
"id" => "ae9b8279-3959-48d8-8a88-741a7f6d4a48",
"name" => "progressive rock"
}
],
"id" => "1932f5b6-0b7b-4050-b1df-833ca89e5f44",
"name" => "Marillion",
"sort-name" => "Marillion",
"type" => "Group",
"type-id" => "e431f5f6-b5d2-343d-8b36-72607fffb74b"
},
"joinphrase" => "",
"name" => "Marillion"
}
],
"disambiguation" => "",
"first-release-date" => "2004-05-03",
"genres" => [
%{
"count" => 1,
"disambiguation" => "",
"id" => "ceeaa283-5d7b-4202-8d1d-e25d116b2a18",
"name" => "alternative rock"
release_group = %{
"artist-credit" => [
%{
"artist" => %{
"disambiguation" => "British progressive rock band",
"genres" => [
%{
"count" => 10,
"disambiguation" => "",
"id" => "ae9b8279-3959-48d8-8a88-741a7f6d4a48",
"name" => "progressive rock"
}
],
"id" => "1932f5b6-0b7b-4050-b1df-833ca89e5f44",
"name" => "Marillion",
"sort-name" => "Marillion",
"type" => "Group",
"type-id" => "e431f5f6-b5d2-343d-8b36-72607fffb74b"
},
%{
"count" => 1,
"disambiguation" => "",
"id" => "b7ef058e-6d83-4ca4-8123-9724bff4648b",
"name" => "art rock"
},
%{
"count" => 1,
"disambiguation" => "",
"id" => "150eb95a-7739-4fde-a5fe-b62ca576a928",
"name" => "baroque pop"
},
%{
"count" => 1,
"disambiguation" => "",
"id" => "797e2e85-5ffd-495c-a757-8b4079052f0e",
"name" => "pop rock"
},
%{
"count" => 2,
"disambiguation" => "",
"id" => "ae9b8279-3959-48d8-8a88-741a7f6d4a48",
"name" => "progressive rock"
},
%{
"count" => 1,
"disambiguation" => "",
"id" => "2aeb5340-c474-4677-b9a6-35ddac9b6a58",
"name" => "psychedelic pop"
},
%{
"count" => 2,
"disambiguation" => "",
"id" => "0e3fc579-2d24-4f20-9dae-736e1ec78798",
"name" => "rock"
}
],
"id" => "20790e26-98e4-3ad3-a67f-b674758b942d",
"primary-type" => "Album",
"primary-type-id" => "f529b476-6e62-324f-b0aa-1f3e33d313fc",
"secondary-type-ids" => [],
"secondary-types" => [],
"title" => "Marbles"
}
"joinphrase" => "",
"name" => "Marillion"
}
],
"disambiguation" => "",
"first-release-date" => "2004-05-03",
"genres" => [
%{
"count" => 1,
"disambiguation" => "",
"id" => "ceeaa283-5d7b-4202-8d1d-e25d116b2a18",
"name" => "alternative rock"
},
%{
"count" => 1,
"disambiguation" => "",
"id" => "b7ef058e-6d83-4ca4-8123-9724bff4648b",
"name" => "art rock"
},
%{
"count" => 1,
"disambiguation" => "",
"id" => "150eb95a-7739-4fde-a5fe-b62ca576a928",
"name" => "baroque pop"
},
%{
"count" => 1,
"disambiguation" => "",
"id" => "797e2e85-5ffd-495c-a757-8b4079052f0e",
"name" => "pop rock"
},
%{
"count" => 2,
"disambiguation" => "",
"id" => "ae9b8279-3959-48d8-8a88-741a7f6d4a48",
"name" => "progressive rock"
},
%{
"count" => 1,
"disambiguation" => "",
"id" => "2aeb5340-c474-4677-b9a6-35ddac9b6a58",
"name" => "psychedelic pop"
},
%{
"count" => 2,
"disambiguation" => "",
"id" => "0e3fc579-2d24-4f20-9dae-736e1ec78798",
"name" => "rock"
}
],
"id" => "20790e26-98e4-3ad3-a67f-b674758b942d",
"primary-type" => "Album",
"primary-type-id" => "f529b476-6e62-324f-b0aa-1f3e33d313fc",
"secondary-type-ids" => [],
"secondary-types" => [],
"title" => "Marbles"
}
expect(APIBehaviourMock, :get_release_group, fn ^first_result_id ->
{:ok, release_group}
end)
@@ -305,6 +305,7 @@ defmodule MusicLibraryWeb.RecordIndexTest do
assert record.title == "Marbles"
assert record.release == "2004-05-03"
assert record.format == :cd
assert record.musicbrainz_data == release_group
assert record.genres == [
"alternative rock",