When not possible to determine otherwise, assums a record has been released

This commit is contained in:
Claudio Ortolina
2025-01-29 10:21:41 +00:00
parent 06f1997d59
commit 96bd453900
2 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -227,7 +227,10 @@ defmodule MusicLibrary.Records.Record do
Date.compare(current_day, release_date) != :lt
_error ->
false
# When a release date cannot be parsed it's normally because the record
# is old and information is not specific, so we can err on the side of assuming
# it's been released.
true
end
end
+2 -2
View File
@@ -27,11 +27,11 @@ defmodule MusicLibrary.Records.RecordTest do
assert MusicLibrary.Records.Record.released?(record, current_date)
end
test "it returns false if the release date is not precise enough", %{
test "it returns true if the release date is not precise enough", %{
current_date: current_date
} do
record = %MusicLibrary.Records.Record{release: "2019"}
refute MusicLibrary.Records.Record.released?(record, current_date)
assert MusicLibrary.Records.Record.released?(record, current_date)
end
end
end