Namespace Last.Fm fixtures
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
defmodule LastFm.ArtistTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
@api_response_path Path.expand("../support/fixtures/artist.getinfo.json", __DIR__)
|
||||
@api_response_path Path.expand("../support/fixtures/last_fm/artist.getinfo.json", __DIR__)
|
||||
|
||||
describe "from_api_response/1" do
|
||||
test "returns correct data" do
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
defmodule LastFm.TrackTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
@api_response_path Path.expand("../support/fixtures/user.getrecenttracks.json", __DIR__)
|
||||
@api_response_path Path.expand("../support/fixtures/last_fm/user.getrecenttracks.json", __DIR__)
|
||||
|
||||
describe "from_api_response/1" do
|
||||
test "returns correct data" do
|
||||
|
||||
@@ -4,7 +4,7 @@ defmodule MusicLibrary.ArtistsTest do
|
||||
alias MusicLibrary.Artists
|
||||
alias LastFm.APIBehaviourMock
|
||||
import MusicLibrary.RecordsFixtures
|
||||
import LastFm.Fixtures
|
||||
import LastFm.Fixtures.Artist
|
||||
import Mox
|
||||
|
||||
setup :verify_on_exit!
|
||||
@@ -46,7 +46,7 @@ defmodule MusicLibrary.ArtistsTest do
|
||||
[artist] = collection_record.artists
|
||||
artist_musicbrainz_id = artist.musicbrainz_id
|
||||
|
||||
expected_info = artist_get_info()
|
||||
expected_info = get_info()
|
||||
|
||||
expect(APIBehaviourMock, :get_artist_info, fn {:musicbrainz_id, ^artist_musicbrainz_id},
|
||||
_config ->
|
||||
|
||||
@@ -2,7 +2,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|
||||
use MusicLibraryWeb.ConnCase
|
||||
|
||||
import MusicLibrary.RecordsFixtures
|
||||
import LastFm.Fixtures
|
||||
import LastFm.Fixtures.Artist
|
||||
import Mox
|
||||
|
||||
alias LastFm.APIBehaviourMock
|
||||
@@ -30,7 +30,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|
||||
} do
|
||||
expect(APIBehaviourMock, :get_artist_info, fn {:musicbrainz_id, ^artist_musicbrainz_id},
|
||||
_config ->
|
||||
{:ok, artist_get_info()}
|
||||
{:ok, get_info()}
|
||||
end)
|
||||
|
||||
conn
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
defmodule LastFm.Fixtures do
|
||||
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures"])
|
||||
defmodule LastFm.Fixtures.Artist do
|
||||
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures/last_fm"])
|
||||
|
||||
alias LastFm.Artist
|
||||
|
||||
def artist_get_info do
|
||||
def get_info do
|
||||
Path.join([@fixtures_folder, "artist.getinfo.json"])
|
||||
|> File.read!()
|
||||
|> JSON.decode!()
|
||||
Reference in New Issue
Block a user