Skip to content

Commit

Permalink
Add test for pyramidal derivative.
Browse files Browse the repository at this point in the history
  • Loading branch information
tpendragon committed Nov 11, 2024
1 parent 6c1a6a0 commit c96dc6f
Showing 1 changed file with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,56 @@ defmodule DpulCollections.IndexingPipeline.Figgy.HydrationCacheEntryTest do
assert doc2[:page_count_i] == 0
end

test "transforms related member image service urls" do
# Add FileMetadata with both a JP2/Pyramidal derivative, to ensure it
# picks the pyramidal
{:ok, entry} =
IndexingPipeline.write_hydration_cache_entry(%{
cache_version: 0,
record_id: "0cff895a-01ea-4895-9c3d-a8c6eaab4013",
source_cache_order: ~U[2018-03-09 20:19:35.465203Z],
related_data: %{
"member_ids" => %{
"1" => %{
"internal_resource" => "FileSet",
"metadata" => %{
"file_metadata" => [
# Not this one - it's an old JP2
%{
"id" => %{"id" => "0cff895a-01ea-4895-9c3d-a8c6eaab4014"},
"internal_resource" => "FileMetadata",
"mime_type" => ["image/jp2"],
"use" => [%{"@id" => "http://pcdm.org/use#ServiceFile"}]
},
%{
"id" => %{"id" => "0cff895a-01ea-4895-9c3d-a8c6eaab4017"},
"internal_resource" => "FileMetadata",
"mime_type" => ["image/tiff"],
"use" => [%{"@id" => "http://pcdm.org/use#ServiceFile"}]
}
]
}
}
}
},
data: %{
"id" => "0cff895a-01ea-4895-9c3d-a8c6eaab4013",
"internal_resource" => "EphemeraFolder",
"metadata" => %{
"member_ids" => [%{"id" => "1"}],
"title" => ["test title 4"]
}
}
})

doc = HydrationCacheEntry.to_solr_document(entry)

# This is the pyramidal derivative.
assert doc[:image_service_urls_ss] == [
"https://iiif-cloud.princeton.edu/iiif/2/0c%2Fff%2F89%2F0cff895a01ea48959c3da8c6eaab4017%2Fintermediate_file"
]
end

test "includes date range if found, date if not" do
entries =
FiggyTestFixtures.hydration_cache_entries()
Expand Down

0 comments on commit c96dc6f

Please sign in to comment.