From dd169fc3d0e0602a002872982fad26007ec80b92 Mon Sep 17 00:00:00 2001 From: Chris Beer Date: Tue, 25 Jul 2023 07:33:52 -0700 Subject: [PATCH] Fix holdingType typo --- lib/folio/eresource_holdings_builder.rb | 2 +- spec/integration/folio_config_spec.rb | 4 ++-- spec/lib/folio/eresource_holdings_builder_spec.rb | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/folio/eresource_holdings_builder.rb b/lib/folio/eresource_holdings_builder.rb index ee394030c..1fbd94eb8 100644 --- a/lib/folio/eresource_holdings_builder.rb +++ b/lib/folio/eresource_holdings_builder.rb @@ -84,7 +84,7 @@ def mapped_location_codes # This approach works fine unless there are records with multiple # e-resource holdings associated with different locations. def electronic_holding_location - @electronic_holding_location ||= holdings&.find { |h| (h.dig('holdingType', 'name') || h.dig('location', 'effectiveLocation', 'details', 'holdingTypeName')) == 'Electronic' } + @electronic_holding_location ||= holdings&.find { |h| (h.dig('holdingsType', 'name') || h.dig('location', 'effectiveLocation', 'details', 'holdingsTypeName')) == 'Electronic' } end end end diff --git a/spec/integration/folio_config_spec.rb b/spec/integration/folio_config_spec.rb index 802bed661..771f32871 100644 --- a/spec/integration/folio_config_spec.rb +++ b/spec/integration/folio_config_spec.rb @@ -113,7 +113,7 @@ let(:items_and_holdings) do { 'items' => [], 'holdings' => - [{ 'holdingType' => { 'name' => 'Electronic' }, + [{ 'holdingsType' => { 'name' => 'Electronic' }, 'location' => { 'permanentLocation' => { 'code' => 'SUL-ELECTRONIC' }, @@ -147,7 +147,7 @@ let(:items_and_holdings) do { 'items' => [], 'holdings' => - [{ 'holdingType' => { 'name' => 'Electronic' }, + [{ 'holdingsType' => { 'name' => 'Electronic' }, 'location' => { 'permanentLocation' => { 'code' => 'LAW-ELECTRONIC' }, diff --git a/spec/lib/folio/eresource_holdings_builder_spec.rb b/spec/lib/folio/eresource_holdings_builder_spec.rb index 400547be2..f9590bd68 100644 --- a/spec/lib/folio/eresource_holdings_builder_spec.rb +++ b/spec/lib/folio/eresource_holdings_builder_spec.rb @@ -24,7 +24,7 @@ let(:items_and_holdings) do { 'items' => [], 'holdings' => - [{ 'holdingType' => { 'name' => 'Electronic' }, + [{ 'holdingsType' => { 'name' => 'Electronic' }, 'location' => { 'permanentLocation' => { 'code' => 'SUL-ELECTRONIC' }, @@ -64,7 +64,7 @@ let(:items_and_holdings) do { 'items' => [], 'holdings' => - [{ 'holdingType' => { 'name' => 'Electronic' }, + [{ 'holdingsType' => { 'name' => 'Electronic' }, 'location' => { 'permanentLocation' => { 'code' => 'LAW-ELECTRONIC' }, @@ -82,7 +82,7 @@ let(:items_and_holdings) do { 'items' => [], 'holdings' => - [{ 'holdingType' => { 'name' => 'Whatever' } }] } + [{ 'holdingsType' => { 'name' => 'Whatever' } }] } end it { expect(holdings).to be_empty } @@ -92,7 +92,7 @@ let(:items_and_holdings) do { 'items' => [], 'holdings' => - [{ 'holdingType' => { 'name' => 'Electronic' }, 'location' => + [{ 'holdingsType' => { 'name' => 'Electronic' }, 'location' => { 'permanentLocation' => { 'code' => 'SUL-SDR' }, 'effectiveLocation' => @@ -104,7 +104,7 @@ it { expect(holdings.first.home_location).to eq 'INTERNET' } end - context 'the holding library is Lane (without a explicit holdingType)' do + context 'the holding library is Lane (without a explicit holdingsType)' do let(:items_and_holdings) do { 'items' => [], 'holdings' => @@ -112,7 +112,7 @@ { 'permanentLocation' => { 'code' => 'LANE-EDATA' }, 'effectiveLocation' => - { 'code' => 'LANE-EDATA', 'details' => { 'holdingTypeName' => 'Electronic' } } }, + { 'code' => 'LANE-EDATA', 'details' => { 'holdingsTypeName' => 'Electronic' } } }, 'suppressFromDiscovery' => false, 'id' => '81a56270-e8dd-5759-8083-5cc96cdf0045', 'holdingsStatements' => [] }] }