55RSpec . describe "Volumes file tree endpoints" , type : :request do
66 let! ( :volume ) { create ( :volume ) }
77 let! ( :user ) { create ( :user , email : "tester@temple.edu" ) }
8+ let! ( :assignee ) { create ( :user , name : "Assigned User" , email : "assigned@example.com" ) }
9+ let! ( :migration_status ) { create ( :migration_status , :default ) }
810
911 before { sign_in user }
1012
3436 create ( :isilon_asset , parent_folder : folder_c ,
3537 isilon_name : "scan_beta_001.tif" ,
3638 isilon_path : "#{ folder_c . full_path } /scan_beta_001.tif" ,
39+ migration_status : migration_status ,
40+ assigned_to : assignee ,
41+ notes : "asset notes" ,
3742 aspace_collection : aspace_collection ,
38- contentdm_collection : contentdm_collection )
43+ contentdm_collection : contentdm_collection ,
44+ preservica_reference_id : "pres-123" ,
45+ aspace_linking_status : true )
3946 end
4047
4148 def parsed
@@ -77,6 +84,29 @@ def parsed
7784 match = json . find { |h | h [ "id" ] == folder . id }
7885 expect ( match [ "descendant_assets_count" ] ) . to eq ( 3 )
7986 end
87+
88+ it "omits asset-only rendering fields from folder payloads" do
89+ get file_tree_volume_path ( volume , format : :json )
90+
91+ expect ( response ) . to have_http_status ( :ok )
92+
93+ match = parsed . find { |h | h [ "id" ] == root . id }
94+ expect ( match ) . to include (
95+ "folder" => true ,
96+ "assigned_to" => "Unassigned" ,
97+ "key" => root . id . to_s ,
98+ "notes" => nil
99+ )
100+ expect ( match . keys ) . not_to include (
101+ "migration_status" ,
102+ "migration_status_id" ,
103+ "contentdm_collection_id" ,
104+ "aspace_collection_id" ,
105+ "preservica_reference_id" ,
106+ "aspace_linking_status" ,
107+ "url"
108+ )
109+ end
80110 end
81111
82112 describe "GET /volumes/:id/file_tree_assets" do
@@ -95,8 +125,16 @@ def parsed
95125 expect ( keys ) . to include ( "a-#{ asset . id } " )
96126 match = body . find { |h | h [ "key" ] == "a-#{ asset . id } " }
97127 expect ( match [ "path" ] ) . to eq ( [ root . id , folder_a . id , folder_b . id , folder_c . id ] )
128+ expect ( match [ "assigned_to" ] ) . to eq ( assignee . name )
129+ expect ( match [ "assigned_to_id" ] ) . to eq ( assignee . id )
130+ expect ( match [ "migration_status" ] ) . to eq ( migration_status . name )
131+ expect ( match [ "migration_status_id" ] ) . to eq ( migration_status . id )
132+ expect ( match [ "notes" ] ) . to eq ( "asset notes" )
98133 expect ( match [ "aspace_collection_id" ] ) . to eq ( aspace_collection . id )
99134 expect ( match [ "contentdm_collection_id" ] ) . to eq ( contentdm_collection . id )
135+ expect ( match [ "preservica_reference_id" ] ) . to eq ( "pres-123" )
136+ expect ( match [ "aspace_linking_status" ] ) . to eq ( "t" )
137+ expect ( match [ "url" ] ) . to end_with ( "/admin/isilon_assets/#{ asset . id } " )
100138 end
101139 end
102140
0 commit comments