Skip to content

Commit

Permalink
Increase test coverage for refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
maxkadel committed Mar 8, 2023
1 parent 8524e0a commit 41bf4fb
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions spec/helpers/holding_block_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
let(:call_number) { 'PS3539.A74Z93 2000' }
let(:search_result) { helper.holding_block_search(SolrDocument.new(document)) }
let(:search_result_thesis) { helper.holding_block_search(SolrDocument.new(document_thesis)) }
let(:search_result_thesis_embargoed) { helper.holding_block_search(SolrDocument.new(document_thesis_embargoed)) }
let(:empty_search_result) { helper.holding_block_search(SolrDocument.new(document_no_holdings)) }

let(:show_result) { helper.holding_request_block(SolrDocument.new(document)) }
Expand Down Expand Up @@ -201,6 +202,29 @@
expect(empty_search_result).to include t('blacklight.holdings.search_missing')
end
end
context '#holding_block_search with both links and holdings' do
let(:document) do
{
id: '1',
format: ['Book'],
holdings_1display: holding_block_json,
electronic_access_1display: '{"https://library.princeton.edu/resource/28076":["library.princeton.edu"]}'
}.with_indifferent_access
end

before { stub_holding_locations }

it 'returns a good string' do
expect(search_result).to include call_number
expect(search_result).to include library
end

it 'includes the online badge and link since there is an electronic access link' do
expect(search_result).to include ">Online</span"
expect(search_result).to include 'title="Electronic access"'
expect(search_result).to include "library.princeton.edu"
end
end
context '#holding_block_search with a missing location code' do
let(:holding_block_json) do
{
Expand Down Expand Up @@ -309,6 +333,14 @@
end
end

context '#holding_block_search with embargoed thesis' do
before { stub_holding_locations }

it 'says that the material is under embargo' do
expect(search_result_thesis_embargoed).to include('title="Availability: Material under embargo"')
end
end

context '#holding_block record show - physical holding thesis reading room request' do
before { stub_holding_locations }

Expand Down

0 comments on commit 41bf4fb

Please sign in to comment.