+ test "preload one collection each for given portable_data_hash list" do
+ use_token :active
+
+ ac = ApplicationController.new
+
+ pdh1 = api_fixture('collections')['foo_file']['portable_data_hash']
+ pdh2 = api_fixture('collections')['bar_file']['portable_data_hash']
+
+ pdhs = [pdh1, pdh2]
+ collections = ac.send :preload_for_pdhs, pdhs
+
+ assert collections, 'Expected collections map'
+ assert collections.is_a?(Hash), 'Expected a hash'
+ # Each pdh has more than one collection; however, we should get only one for each
+ assert collections.size == 2, 'Expected two objects in the preloaded collection hash'
+ assert collections[pdh1], 'Expected collections for the passed in pdh #{pdh1}'
+ assert_equal collections[pdh1].size, 1, 'Expected one collection for the passed in pdh #{pdh1}'
+ assert collections[pdh2], 'Expected collections for the passed in pdh #{pdh2}'
+ assert_equal collections[pdh2].size, 1, 'Expected one collection for the passed in pdh #{pdh2}'
+ end
+