Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/graphql/types/record_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def dois
end

def deprecated_identifiers(field)
@object['identifiers'].map { |id| id['value'] if id['kind'] == field }.compact
@object['identifiers']&.map { |id| id['value'] if id['kind'] == field }&.compact
end
end
end
6 changes: 6 additions & 0 deletions test/graphql/types/record_type_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ class RecordTypeTest < ActiveSupport::TestCase
result = record_type.file_formats
assert_equal %w[PDF EPUB], result, 'file_formats should return unique values'
end

test 'deprecated identifiers return nil when identifiers key is missing' do
record_type = Types::RecordType.send(:new, { 'title' => 'Test Record' }, {})

assert_nil record_type.isbns
end
end
Loading