Enable quokka with :module_directives rule
This commit is contained in:
+5
-2
@@ -1,6 +1,9 @@
|
||||
[
|
||||
import_deps: [:ecto, :ecto_sql, :oban, :oban_web, :phoenix, :phoenix_live_view],
|
||||
subdirectories: ["priv/*/migrations"],
|
||||
plugins: [Phoenix.LiveView.HTMLFormatter],
|
||||
inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}", "priv/*/seeds.exs"]
|
||||
plugins: [Phoenix.LiveView.HTMLFormatter, Quokka],
|
||||
inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}", "priv/*/seeds.exs"],
|
||||
quokka: [
|
||||
only: [:module_directives]
|
||||
]
|
||||
]
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import Helpers
|
||||
|
||||
defmodule Helpers do
|
||||
def debug! do
|
||||
Logger.configure(level: :debug)
|
||||
@@ -11,5 +13,3 @@ defmodule Helpers do
|
||||
Logger.configure(level: :warning)
|
||||
end
|
||||
end
|
||||
|
||||
import Helpers
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
defmodule LastFm.API do
|
||||
require Logger
|
||||
|
||||
alias LastFm.{Artist, Session, Track}
|
||||
alias LastFm.API.{ErrorResponse, Signature}
|
||||
alias LastFm.{Artist, Session, Track}
|
||||
|
||||
require Logger
|
||||
|
||||
def get_session(token, config) do
|
||||
params =
|
||||
|
||||
@@ -35,10 +35,10 @@ defmodule LastFm.Refresh do
|
||||
|
||||
use GenServer
|
||||
|
||||
require Logger
|
||||
|
||||
alias LastFm.{API, Config, Feed}
|
||||
|
||||
require Logger
|
||||
|
||||
@type config :: Config.t()
|
||||
|
||||
@spec start_link(config) :: GenServer.on_start()
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
defmodule Mix.Tasks.Esbuild.CheckVersion do
|
||||
use Mix.Task
|
||||
|
||||
@shortdoc "Checks the the current Esbuild version is the latest"
|
||||
@moduledoc """
|
||||
Checks the the current esbuild version is the latest.
|
||||
@@ -8,6 +6,8 @@ defmodule Mix.Tasks.Esbuild.CheckVersion do
|
||||
Exits with 0 if versions match, 1 if the esbuild needs to be updated.
|
||||
"""
|
||||
|
||||
use Mix.Task
|
||||
|
||||
alias Mix.Tasks.Esbuild.Release
|
||||
|
||||
@impl Mix.Task
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
defmodule Mix.Tasks.Esbuild.UpdateVersion do
|
||||
use Mix.Task
|
||||
|
||||
@shortdoc "Update the configured esbuild versino to latest."
|
||||
@moduledoc """
|
||||
Update the configured esbuild versino to latest.
|
||||
"""
|
||||
|
||||
use Mix.Task
|
||||
|
||||
alias Mix.Tasks.Esbuild.Release
|
||||
|
||||
@impl Mix.Task
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
defmodule Mix.Tasks.MusicBrainz.RefreshFixtures do
|
||||
use Mix.Task
|
||||
|
||||
@shortdoc "Fetch and recreate test fixtures that depend on network resources."
|
||||
@moduledoc """
|
||||
Fetch and recreate test fixtures that depend on network resources.
|
||||
"""
|
||||
|
||||
use Mix.Task
|
||||
|
||||
require Logger
|
||||
|
||||
@fixtures_folder Path.join([File.cwd!(), "test/support/fixtures/music_brainz"])
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
defmodule Mix.Tasks.MusicLibrary.Prod.DbMigrate do
|
||||
use Mix.Task
|
||||
@shortdoc "Run migrations on the production database"
|
||||
@moduledoc """
|
||||
Run migrations on the production database.
|
||||
@@ -7,6 +6,8 @@ defmodule Mix.Tasks.MusicLibrary.Prod.DbMigrate do
|
||||
Requires the `flyctl` CLI to be installed and authenticated.
|
||||
"""
|
||||
|
||||
use Mix.Task
|
||||
|
||||
import Mix.Tasks.MusicLibrary.Prod.Helpers
|
||||
|
||||
@impl Mix.Task
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
defmodule Mix.Tasks.MusicLibrary.Prod.DbPull do
|
||||
use Mix.Task
|
||||
@shortdoc "Pulls the latest database from the production server"
|
||||
@moduledoc """
|
||||
Pulls the latest database from the production server.
|
||||
|
||||
Requires the `flyctl` CLI to be installed and authenticated.
|
||||
"""
|
||||
use Mix.Task
|
||||
|
||||
import Mix.Tasks.MusicLibrary.Prod.Helpers
|
||||
|
||||
@impl Mix.Task
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
defmodule Mix.Tasks.MusicLibrary.Prod.DbVacuum do
|
||||
use Mix.Task
|
||||
@shortdoc "Force VACUUM the production database"
|
||||
@moduledoc """
|
||||
Force VACUUM the production database. This is necessary to make sure that all
|
||||
@@ -8,6 +7,8 @@ defmodule Mix.Tasks.MusicLibrary.Prod.DbVacuum do
|
||||
Requires the `flyctl` CLI to be installed and authenticated.
|
||||
"""
|
||||
|
||||
use Mix.Task
|
||||
|
||||
import Mix.Tasks.MusicLibrary.Prod.Helpers
|
||||
|
||||
@impl Mix.Task
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
defmodule Mix.Tasks.MusicLibrary.Prod.Ping do
|
||||
use Mix.Task
|
||||
@shortdoc "Ping the production instance"
|
||||
@moduledoc """
|
||||
Ping the production instance - useful to wake it up if suspended.
|
||||
"""
|
||||
|
||||
use Mix.Task
|
||||
|
||||
@impl Mix.Task
|
||||
def run(_args) do
|
||||
Application.ensure_all_started(:req)
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
defmodule Mix.Tasks.Obsidian.Import do
|
||||
use Mix.Task
|
||||
|
||||
@shortdoc "Import records from an Obsidian Vault containing Media entries "
|
||||
@moduledoc """
|
||||
Import records from an Obsidian Vault containing Media entries.
|
||||
@@ -10,6 +8,8 @@ defmodule Mix.Tasks.Obsidian.Import do
|
||||
`mix obsidian.import path/to/vault`
|
||||
"""
|
||||
|
||||
use Mix.Task
|
||||
|
||||
@impl Mix.Task
|
||||
def run(args) do
|
||||
case args do
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
defmodule Mix.Tasks.Tailwind.CheckVersion do
|
||||
use Mix.Task
|
||||
|
||||
@shortdoc "Checks the the current Tailwind version is the latest"
|
||||
@moduledoc """
|
||||
Checks the the current Tailwind version is the latest.
|
||||
@@ -8,6 +6,8 @@ defmodule Mix.Tasks.Tailwind.CheckVersion do
|
||||
Exits with 0 if versions match, 1 if the Tailwind needs to be updated.
|
||||
"""
|
||||
|
||||
use Mix.Task
|
||||
|
||||
alias Mix.Tasks.Tailwind.Release
|
||||
|
||||
@impl Mix.Task
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
defmodule Mix.Tasks.Tailwind.UpdateVersion do
|
||||
use Mix.Task
|
||||
|
||||
@shortdoc "Update the configured tailwind versino to latest."
|
||||
@moduledoc """
|
||||
Update the configured tailwind versino to latest.
|
||||
"""
|
||||
|
||||
use Mix.Task
|
||||
|
||||
alias Mix.Tasks.Tailwind.Release
|
||||
|
||||
@impl Mix.Task
|
||||
|
||||
@@ -6,10 +6,10 @@ defmodule MusicBrainz.API do
|
||||
- Extend the metadata associated with existing records
|
||||
"""
|
||||
|
||||
require Logger
|
||||
|
||||
alias MusicBrainz.{Artist, ReleaseGroupSearchResult, ReleaseSearchResult}
|
||||
|
||||
require Logger
|
||||
|
||||
@doc """
|
||||
Uses the [lookup](https://musicbrainz.org/doc/MusicBrainz_API#Lookups) endpoint with the release group id and include the
|
||||
associated artists, genres, releases and release group relations. Note that the API limits each included resource to 25 items.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
defmodule MusicBrainz.ReleaseGroupSearchResult do
|
||||
alias MusicBrainz.ReleaseGroup
|
||||
|
||||
@enforce_keys [:id, :type, :title, :artists, :release_date]
|
||||
defstruct [:id, :type, :title, :artists, :release_date]
|
||||
|
||||
alias MusicBrainz.ReleaseGroup
|
||||
|
||||
def from_api_response(rg) do
|
||||
%__MODULE__{
|
||||
id: rg["id"],
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
defmodule MusicBrainz.ReleaseSearchResult do
|
||||
alias MusicBrainz.ReleaseGroup
|
||||
|
||||
@enforce_keys [:id, :title, :release_group, :artists, :date, :barcode, :media]
|
||||
defstruct [:id, :title, :release_group, :artists, :date, :barcode, :media]
|
||||
|
||||
alias MusicBrainz.ReleaseGroup
|
||||
|
||||
def from_api_response(r) do
|
||||
%__MODULE__{
|
||||
id: r["id"],
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
defmodule MusicLibrary.Artists do
|
||||
import Ecto.Query, warn: false
|
||||
alias MusicLibrary.Repo
|
||||
|
||||
alias MusicLibrary.Artists.ArtistInfo
|
||||
alias MusicLibrary.Records.{ArtistRecord, Record}
|
||||
alias MusicLibrary.Repo
|
||||
alias MusicLibrary.{BackgroundRepo, Worker}
|
||||
|
||||
def get_artist!(musicbrainz_id) do
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
defmodule MusicLibrary.Artists.ArtistInfo do
|
||||
use Ecto.Schema
|
||||
|
||||
import Ecto.Changeset
|
||||
|
||||
alias MusicLibrary.Records.Cover
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
defmodule MusicLibrary.Collection do
|
||||
import Ecto.Query, warn: false
|
||||
import MusicLibrary.Records, only: [order_alphabetically: 0]
|
||||
|
||||
alias MusicLibrary.Records
|
||||
alias MusicLibrary.Records.{Record, SearchIndex}
|
||||
alias MusicLibrary.Repo
|
||||
|
||||
import MusicLibrary.Records, only: [order_alphabetically: 0]
|
||||
|
||||
def search_records(query, opts \\ []) do
|
||||
limit = Keyword.get(opts, :limit, 20)
|
||||
offset = Keyword.get(opts, :offset, 0)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
defmodule MusicLibrary.Records.Batch do
|
||||
require Logger
|
||||
import Ecto.Query
|
||||
|
||||
alias MusicLibrary.Records
|
||||
alias MusicLibrary.Records.{Cover, Record}
|
||||
alias MusicLibrary.Repo
|
||||
import Ecto.Query
|
||||
|
||||
require Logger
|
||||
|
||||
def refresh_musicbrainz_data(opts \\ []) do
|
||||
run_on_all_records(fn record ->
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
defmodule MusicLibrary.Records.Record do
|
||||
use Ecto.Schema
|
||||
|
||||
import Ecto.Changeset
|
||||
|
||||
alias MusicBrainz.{Release, ReleaseGroup}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
defmodule MusicLibrary.Secrets.Secret do
|
||||
use Ecto.Schema
|
||||
|
||||
import Ecto.Changeset
|
||||
|
||||
@primary_key {:name, :string, autogenerate: false}
|
||||
|
||||
@@ -23,10 +23,11 @@ defmodule MusicLibraryWeb do
|
||||
quote do
|
||||
use Phoenix.Router, helpers: false
|
||||
|
||||
# Import common connection and controller functions to use in pipelines
|
||||
import Plug.Conn
|
||||
import Phoenix.Controller
|
||||
import Phoenix.LiveView.Router
|
||||
|
||||
# Import common connection and controller functions to use in pipelines
|
||||
import Plug.Conn
|
||||
end
|
||||
end
|
||||
|
||||
@@ -76,7 +77,6 @@ defmodule MusicLibraryWeb do
|
||||
def html do
|
||||
quote do
|
||||
use Phoenix.Component
|
||||
|
||||
use Gettext, backend: MusicLibraryWeb.Gettext
|
||||
|
||||
# Import convenience functions from controllers
|
||||
@@ -91,10 +91,11 @@ defmodule MusicLibraryWeb do
|
||||
defp html_helpers do
|
||||
quote do
|
||||
use Gettext, backend: MusicLibraryWeb.Gettext
|
||||
|
||||
import MusicLibraryWeb.CoreComponents
|
||||
# HTML escaping functionality
|
||||
import Phoenix.HTML
|
||||
# Core UI components and translation
|
||||
import MusicLibraryWeb.CoreComponents
|
||||
|
||||
# Shortcut for generating JS commands
|
||||
alias Phoenix.LiveView.JS
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
defmodule MusicLibraryWeb.Auth do
|
||||
use Gettext, backend: MusicLibraryWeb.Gettext
|
||||
import Plug.Conn
|
||||
|
||||
import Phoenix.Controller, only: [put_flash: 3, redirect: 2]
|
||||
import Plug.Conn
|
||||
|
||||
def correct_login_password?(password) do
|
||||
Plug.Crypto.secure_compare(login_password(), password)
|
||||
|
||||
@@ -15,9 +15,9 @@ defmodule MusicLibraryWeb.CoreComponents do
|
||||
Icons are provided by [heroicons](https://heroicons.com). See `icon/1` for usage.
|
||||
"""
|
||||
use Phoenix.Component
|
||||
use Gettext, backend: MusicLibraryWeb.Gettext
|
||||
|
||||
alias Phoenix.LiveView.JS
|
||||
use Gettext, backend: MusicLibraryWeb.Gettext
|
||||
|
||||
defdelegate badge(assigns), to: Fluxon.Components.Badge
|
||||
defdelegate button(assigns), to: Fluxon.Components.Button
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
defmodule MusicLibraryWeb.ArtistLive.Show do
|
||||
use MusicLibraryWeb, :live_view
|
||||
|
||||
alias MusicLibrary.Artists.ArtistInfo
|
||||
alias MusicLibrary.{Artists, Records}
|
||||
|
||||
import MusicLibraryWeb.RecordComponents,
|
||||
only: [record_grid: 1, toggle_actions_menu: 1, close_actions_menu: 1, country_label: 1]
|
||||
|
||||
alias MusicLibrary.Artists.ArtistInfo
|
||||
alias MusicLibrary.{Artists, Records}
|
||||
|
||||
attr :country, :map, required: true
|
||||
|
||||
defp country_flag(assigns) do
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
defmodule MusicLibraryWeb.CollectionLive.Index do
|
||||
use MusicLibraryWeb, :live_view
|
||||
|
||||
import MusicLibraryWeb.BarcodeScannerComponent, only: [barcode_icon: 1]
|
||||
import MusicLibraryWeb.PaginationComponent
|
||||
import MusicLibraryWeb.RecordComponents
|
||||
import MusicLibraryWeb.BarcodeScannerComponent, only: [barcode_icon: 1]
|
||||
|
||||
alias MusicLibrary.Collection
|
||||
alias MusicLibrary.Records
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
defmodule MusicLibraryWeb.StatsLive.Index do
|
||||
use MusicLibraryWeb, :live_view
|
||||
|
||||
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
|
||||
import MusicLibraryWeb.ChartComponents
|
||||
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
|
||||
|
||||
alias MusicLibrary.{Collection, Records, ScrobbleActivity, Wishlist}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
defmodule MusicLibraryWeb.WishlistLive.Index do
|
||||
use MusicLibraryWeb, :live_view
|
||||
|
||||
import MusicLibraryWeb.PaginationComponent
|
||||
import MusicLibraryWeb.RecordComponents
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ defmodule MusicLibraryWeb.Router do
|
||||
|
||||
if Application.compile_env(:music_library, :monitoring_routes) do
|
||||
use ErrorTracker.Web, :router
|
||||
|
||||
import Phoenix.LiveDashboard.Router
|
||||
|
||||
scope "/dev" do
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
defmodule MusicLibraryWeb.Telemetry do
|
||||
use Supervisor
|
||||
|
||||
import Telemetry.Metrics
|
||||
|
||||
def start_link(arg) do
|
||||
|
||||
@@ -71,6 +71,7 @@ defmodule MusicLibrary.MixProject do
|
||||
{:esbuild, "~> 0.8", runtime: Mix.env() == :dev},
|
||||
{:tailwind, "~> 0.3", runtime: Mix.env() == :dev},
|
||||
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
|
||||
{:quokka, "~> 2.6", only: [:dev, :test], runtime: false},
|
||||
{:live_debugger, "~> 0.2.0", only: :dev},
|
||||
{:tidewave, "~> 0.1", only: :dev},
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
"phoenix_test": {:hex, :phoenix_test, "0.6.0", "4ad75354b16b1c6f1f4723a9efd39e755746450355b36e1d23e0778624fe9d7f", [:mix], [{:floki, ">= 0.30.0", [hex: :floki, repo: "hexpm", optional: false]}, {:jason, "~> 1.4", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, ">= 1.0.0", [hex: :mime, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.7.10", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.20 or ~> 1.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "31dc45d07ac2f86a029e71075e785343b0913bd96a91394c51798426372a6e80"},
|
||||
"plug": {:hex, :plug, "1.18.0", "d78df36c41f7e798f2edf1f33e1727eae438e9dd5d809a9997c463a108244042", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "819f9e176d51e44dc38132e132fe0accaf6767eab7f0303431e404da8476cfa2"},
|
||||
"plug_crypto": {:hex, :plug_crypto, "2.1.1", "19bda8184399cb24afa10be734f84a16ea0a2bc65054e23a62bb10f06bc89491", [:mix], [], "hexpm", "6470bce6ffe41c8bd497612ffde1a7e4af67f36a15eea5f921af71cf3e11247c"},
|
||||
"quokka": {:hex, :quokka, "2.6.0", "a34ff876968fcef20594e349bd7d9a940c0ba85830d0efd8416ee8c0de4c430d", [:mix], [{:credo, "~> 1.7", [hex: :credo, repo: "hexpm", optional: false]}], "hexpm", "52ea62131cef122e2daddbb3b9f61b14d04adcb39316fe0dae03ca65eeec270b"},
|
||||
"recon": {:hex, :recon, "2.5.6", "9052588e83bfedfd9b72e1034532aee2a5369d9d9343b61aeb7fbce761010741", [:mix, :rebar3], [], "hexpm", "96c6799792d735cc0f0fd0f86267e9d351e63339cbe03df9d162010cefc26bb0"},
|
||||
"req": {:hex, :req, "0.5.10", "a3a063eab8b7510785a467f03d30a8d95f66f5c3d9495be3474b61459c54376c", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:ezstd, "~> 1.0", [hex: :ezstd, repo: "hexpm", optional: true]}, {:finch, "~> 0.17", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 2.0.6 or ~> 2.1", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "8a604815743f8a2d3b5de0659fa3137fa4b1cffd636ecb69b30b2b9b2c2559be"},
|
||||
"table_rex": {:hex, :table_rex, "4.1.0", "fbaa8b1ce154c9772012bf445bfb86b587430fb96f3b12022d3f35ee4a68c918", [:mix], [], "hexpm", "95932701df195d43bc2d1c6531178fc8338aa8f38c80f098504d529c43bc2601"},
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
defmodule MusicBrainzTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
alias MusicBrainz.ReleaseGroupSearchResult
|
||||
import MusicBrainz.Fixtures.Release
|
||||
import MusicBrainz.Fixtures.ReleaseGroup
|
||||
|
||||
alias MusicBrainz.ReleaseGroupSearchResult
|
||||
|
||||
describe "search_release_group/2" do
|
||||
test "it returns results with correct limit and offset" do
|
||||
results = release_group_search_results()
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
defmodule MusicLibrary.ArtistsTest do
|
||||
use MusicLibrary.DataCase
|
||||
|
||||
alias MusicLibrary.Artists
|
||||
import MusicLibrary.Fixtures.Records
|
||||
|
||||
alias MusicLibrary.Artists
|
||||
|
||||
describe "get_artist/1" do
|
||||
test "it returns records with essential data" do
|
||||
record = record()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
defmodule MusicLibrary.BarcodeScan.ResultTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
alias MusicLibrary.BarcodeScan.Result
|
||||
alias MusicBrainz.{ReleaseGroupSearchResult, ReleaseSearchResult}
|
||||
alias MusicLibrary.BarcodeScan.Result
|
||||
|
||||
@release_group %ReleaseGroupSearchResult{
|
||||
id: "123",
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
defmodule MusicLibrary.CollectionTest do
|
||||
use MusicLibrary.DataCase
|
||||
|
||||
alias MusicLibrary.Collection
|
||||
import MusicLibrary.Fixtures.Records
|
||||
|
||||
alias MusicLibrary.Collection
|
||||
|
||||
defp fill_collection(_) do
|
||||
# Purchased dates are in ascending order
|
||||
records = [
|
||||
|
||||
@@ -2,6 +2,7 @@ defmodule MusicLibrary.Records.CoverTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
import MusicLibrary.Fixtures.Records
|
||||
|
||||
alias MusicLibrary.Records.Cover
|
||||
|
||||
describe "resize/1" do
|
||||
|
||||
@@ -2,6 +2,7 @@ defmodule MusicLibrary.Records.RecordTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
import MusicBrainz.Fixtures.ReleaseGroup
|
||||
|
||||
alias MusicLibrary.Records.Record
|
||||
|
||||
doctest Record
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
defmodule MusicLibrary.RecordsTest do
|
||||
use MusicLibrary.DataCase
|
||||
|
||||
import MusicBrainz.Fixtures.Release
|
||||
import MusicBrainz.Fixtures.ReleaseGroup
|
||||
import MusicLibrary.Fixtures.Records
|
||||
|
||||
alias MusicLibrary.Records
|
||||
alias MusicLibrary.Records.SearchIndex
|
||||
import MusicLibrary.Fixtures.Records
|
||||
import MusicBrainz.Fixtures.ReleaseGroup
|
||||
import MusicBrainz.Fixtures.Release
|
||||
|
||||
defp create_records(_) do
|
||||
records = [
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
defmodule MusicLibrary.WishlistTest do
|
||||
use MusicLibrary.DataCase
|
||||
|
||||
alias MusicLibrary.Wishlist
|
||||
import MusicLibrary.Fixtures.Records
|
||||
|
||||
alias MusicLibrary.Wishlist
|
||||
|
||||
defp fill_wishlist(_) do
|
||||
records = [
|
||||
record(%{purchased_at: nil, title: "Brave"}),
|
||||
|
||||
@@ -2,6 +2,7 @@ defmodule MusicLibraryWeb.CoverControllerTest do
|
||||
use MusicLibraryWeb.ConnCase
|
||||
|
||||
import MusicLibrary.Fixtures.Records
|
||||
|
||||
alias MusicLibrary.Records.Cover
|
||||
|
||||
defp create_record(_) do
|
||||
|
||||
@@ -2,6 +2,7 @@ defmodule MusicLibraryWeb.ArtistLive.ShowTest do
|
||||
use MusicLibraryWeb.ConnCase
|
||||
|
||||
import MusicLibrary.Fixtures.Records
|
||||
|
||||
alias LastFm.Fixtures
|
||||
|
||||
defp fill_collection(_config) do
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
defmodule MusicLibraryWeb.CollectionLive.IndexTest do
|
||||
use MusicLibraryWeb.ConnCase
|
||||
|
||||
import MusicLibrary.Fixtures.Records
|
||||
import MusicBrainz.Fixtures.ReleaseGroup
|
||||
import MusicBrainz.Fixtures.Release
|
||||
import MusicBrainz.Fixtures.ReleaseGroup
|
||||
import MusicLibrary.Fixtures.Records
|
||||
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
|
||||
|
||||
alias MusicBrainz.ReleaseGroupSearchResult
|
||||
alias MusicLibrary.Records.{Cover, Record}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ defmodule MusicLibraryWeb.CollectionLive.ShowTest do
|
||||
use MusicLibraryWeb.ConnCase
|
||||
|
||||
import MusicLibrary.Fixtures.Records
|
||||
|
||||
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
|
||||
|
||||
alias MusicBrainz.Fixtures
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
defmodule MusicLibraryWeb.StatsLive.IndexTest do
|
||||
use MusicLibraryWeb.ConnCase
|
||||
|
||||
alias MusicLibrary.{Records, Repo, Wishlist}
|
||||
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
|
||||
import MusicLibrary.Fixtures.Records
|
||||
import MusicBrainz.Fixtures.ReleaseGroup
|
||||
import MusicBrainz.Fixtures.Release
|
||||
import MusicBrainz.Fixtures.ReleaseGroup
|
||||
import MusicLibrary.Fixtures.Records
|
||||
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
|
||||
|
||||
alias MusicLibrary.{Records, Repo, Wishlist}
|
||||
|
||||
defp fill_collection(_) do
|
||||
current_time = DateTime.utc_now()
|
||||
|
||||
@@ -2,7 +2,6 @@ defmodule MusicLibraryWeb.WishlistLive.ShowTest do
|
||||
use MusicLibraryWeb.ConnCase
|
||||
|
||||
import MusicLibrary.Fixtures.Records
|
||||
|
||||
import MusicLibraryWeb.RecordComponents, only: [format_label: 1, type_label: 1]
|
||||
|
||||
alias MusicLibrary.Records.Record
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
defmodule MusicLibraryWeb.AuthTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
import Plug.Test
|
||||
|
||||
alias MusicLibraryWeb.Auth
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
defmodule Obsidian.ParserTest do
|
||||
use ExUnit.Case, async: true
|
||||
|
||||
alias Obsidian.{Entry, Parser}
|
||||
|
||||
@marbles_entry_path Path.expand("../support/fixtures/obsidian/marillion-marbles.md", __DIR__)
|
||||
|
||||
@@ -19,21 +19,22 @@ defmodule MusicLibraryWeb.ConnCase do
|
||||
|
||||
using do
|
||||
quote do
|
||||
# The default endpoint for testing
|
||||
@endpoint MusicLibraryWeb.Endpoint
|
||||
|
||||
use MusicLibraryWeb, :verified_routes
|
||||
|
||||
# Import conveniences for testing with connections
|
||||
import Plug.Conn
|
||||
import Phoenix.ConnTest
|
||||
import MusicLibraryWeb.ConnCase
|
||||
import PhoenixTest
|
||||
import MusicLibraryWeb.LiveTestHelpers
|
||||
import Phoenix.ConnTest
|
||||
|
||||
import Phoenix.LiveViewTest,
|
||||
# The default endpoint for testing
|
||||
only: [render: 1, render_async: 1, render_hook: 2, render_hook: 3, element: 2, element: 3]
|
||||
|
||||
import MusicLibraryWeb.LiveTestHelpers
|
||||
import PhoenixTest
|
||||
import Plug.Conn
|
||||
|
||||
@endpoint MusicLibraryWeb.Endpoint
|
||||
|
||||
# Import conveniences for testing with connections
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@ defmodule MusicLibrary.DataCase do
|
||||
quote do
|
||||
use Oban.Testing, repo: MusicLibrary.BackgroundRepo
|
||||
|
||||
alias MusicLibrary.Repo
|
||||
|
||||
import Ecto
|
||||
import Ecto.Changeset
|
||||
import Ecto.Query
|
||||
import MusicLibrary.DataCase
|
||||
|
||||
alias MusicLibrary.Repo
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user