Track fixture files as external resources

This commit is contained in:
Claudio Ortolina
2026-04-17 14:02:45 +01:00
parent 079f2a5f0f
commit fd6eab82c0
7 changed files with 33 additions and 0 deletions
@@ -3,6 +3,7 @@ defmodule BraveSearch.Fixtures do
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures/brave_search"])
@external_resource Path.join([@fixtures_folder, "search_images_response.json"])
@search_images_response Path.join([@fixtures_folder, "search_images_response.json"])
|> File.read!()
|> JSON.decode!()
+2
View File
@@ -2,10 +2,12 @@ defmodule Discogs.Fixtures.Artist do
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures/discogs"])
# Cache fixtures at compile time to avoid repeated file I/O
@external_resource Path.join([@fixtures_folder, "artist - steven wilson.json"])
@get_artist Path.join([@fixtures_folder, "artist - steven wilson.json"])
|> File.read!()
|> JSON.decode!()
@external_resource Path.join([@fixtures_folder, "steven wilson.jpeg"])
@image_data Path.join([@fixtures_folder, "steven wilson.jpeg"])
|> File.read!()
+1
View File
@@ -2,6 +2,7 @@ defmodule LastFm.Fixtures.Artist do
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures/last_fm"])
# Cache fixtures at compile time to avoid repeated file I/O
@external_resource Path.join([@fixtures_folder, "artist.getinfo.json"])
@get_info Path.join([@fixtures_folder, "artist.getinfo.json"])
|> File.read!()
|> JSON.decode!()
@@ -2,6 +2,7 @@ defmodule MusicBrainz.Fixtures.Artist do
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures/music_brainz"])
# Cache fixtures at compile time to avoid repeated file I/O
@external_resource Path.join([@fixtures_folder, "artist - steven wilson.json"])
@get_artist Path.join([@fixtures_folder, "artist - steven wilson.json"])
|> File.read!()
|> JSON.decode!()
@@ -2,6 +2,7 @@ defmodule MusicBrainz.Fixtures.Release do
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures/music_brainz"])
# Cache JSON fixtures at compile time to avoid repeated file I/O
@external_resource Path.join([@fixtures_folder, "releases - queen - greatest hits.json"])
@releases_queen_greatest_hits Path.join([
@fixtures_folder,
"releases - queen - greatest hits.json"
@@ -9,10 +10,15 @@ defmodule MusicBrainz.Fixtures.Release do
|> File.read!()
|> JSON.decode!()
@external_resource Path.join([@fixtures_folder, "releases - marillion - marbles.json"])
@releases_marbles Path.join([@fixtures_folder, "releases - marillion - marbles.json"])
|> File.read!()
|> JSON.decode!()
@external_resource Path.join([
@fixtures_folder,
"release - avantasia - the mystery of time.json"
])
@release_mystery_of_time Path.join([
@fixtures_folder,
"release - avantasia - the mystery of time.json"
@@ -20,10 +26,15 @@ defmodule MusicBrainz.Fixtures.Release do
|> File.read!()
|> JSON.decode!()
@external_resource Path.join([@fixtures_folder, "release - marillion - marbles.json"])
@release_marbles Path.join([@fixtures_folder, "release - marillion - marbles.json"])
|> File.read!()
|> JSON.decode!()
@external_resource Path.join([
@fixtures_folder,
"release_with_media - marillion - marbles.json"
])
@release_with_media_marbles Path.join([
@fixtures_folder,
"release_with_media - marillion - marbles.json"
@@ -2,6 +2,10 @@ defmodule MusicBrainz.Fixtures.ReleaseGroup do
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures/music_brainz"])
# Cache JSON fixtures at compile time to avoid repeated file I/O
@external_resource Path.join([
@fixtures_folder,
"release_group_search_results - marillion - marbles.json"
])
@release_group_search_results Path.join([
@fixtures_folder,
"release_group_search_results - marillion - marbles.json"
@@ -9,6 +13,10 @@ defmodule MusicBrainz.Fixtures.ReleaseGroup do
|> File.read!()
|> JSON.decode!()
@external_resource Path.join([
@fixtures_folder,
"release_group - avantasia - the mystery of time.json"
])
@mystery_of_time Path.join([
@fixtures_folder,
"release_group - avantasia - the mystery of time.json"
@@ -16,10 +24,15 @@ defmodule MusicBrainz.Fixtures.ReleaseGroup do
|> File.read!()
|> JSON.decode!()
@external_resource Path.join([@fixtures_folder, "release_group - marillion - marbles.json"])
@marbles Path.join([@fixtures_folder, "release_group - marillion - marbles.json"])
|> File.read!()
|> JSON.decode!()
@external_resource Path.join([
@fixtures_folder,
"release_group_with_includes - mariusz duda - lockdown trilogy.json"
])
@lockdown_trilogy Path.join([
@fixtures_folder,
"release_group_with_includes - mariusz duda - lockdown trilogy.json"
@@ -2,18 +2,22 @@ defmodule Wikipedia.Fixtures do
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures/wikipedia"])
# Cache fixtures at compile time to avoid repeated file I/O
@external_resource Path.join([@fixtures_folder, "wikidata_response.json"])
@wikidata_response Path.join([@fixtures_folder, "wikidata_response.json"])
|> File.read!()
|> JSON.decode!()
@external_resource Path.join([@fixtures_folder, "wikidata_response_no_enwiki.json"])
@wikidata_response_no_enwiki Path.join([@fixtures_folder, "wikidata_response_no_enwiki.json"])
|> File.read!()
|> JSON.decode!()
@external_resource Path.join([@fixtures_folder, "article_summary.json"])
@article_summary Path.join([@fixtures_folder, "article_summary.json"])
|> File.read!()
|> JSON.decode!()
@external_resource Path.join([@fixtures_folder, "article_extract.json"])
@article_extract Path.join([@fixtures_folder, "article_extract.json"])
|> File.read!()
|> JSON.decode!()