• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pulibrary / pdc_discovery / 1eedbc4b-a89e-4e81-990b-d6c1d10c7ef0

17 Aug 2023 02:13PM UTC coverage: 92.352% (-4.2%) from 96.544%
1eedbc4b-a89e-4e81-990b-d6c1d10c7ef0

Pull #477

circleci

jrgriffiniii
noop
Pull Request #477: Ensuring that DOIs which resolve to multiple Solr Documents explicitly prefer the Solr Document indexed from PDC Describe

55 of 55 new or added lines in 2 files covered. (100.0%)

2222 of 2406 relevant lines covered (92.35%)

180.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

43.1
/spec/system/bitklavier_single_item_metadata_spec.rb
1
# frozen_string_literal: true
2

3
describe 'PDC Describe Bitklavier Single item page', type: :system, js: true do
1✔
4
  let(:rss_feed) { file_fixture("works.rss").read }
4✔
5
  let(:resource1) { file_fixture("sowing_the_seeds.json").read }
4✔
6
  let(:bitklavier_binaural_json) { file_fixture("bitklavier_binaural.json").read }
4✔
7
  let(:rss_url_string) { "https://pdc-describe-prod.princeton.edu/describe/works.rss" }
4✔
8
  let(:indexer) { DescribeIndexer.new(rss_url: rss_url_string) }
4✔
9

10
  before do
1✔
11
    Blacklight.default_index.connection.delete_by_query("*:*")
3✔
12
    Blacklight.default_index.connection.commit
3✔
13
    stub_request(:get, "https://pdc-describe-prod.princeton.edu/describe/works.rss")
3✔
14
      .to_return(status: 200, body: rss_feed, headers: {})
15
    stub_request(:get, "https://pdc-describe-prod.princeton.edu/describe/works/6.json")
3✔
16
      .to_return(status: 200, body: resource1, headers: {})
17
    stub_request(:get, "https://pdc-describe-prod.princeton.edu/describe/works/20.json")
3✔
18
      .to_return(status: 200, body: bitklavier_binaural_json, headers: {})
19
    indexer.index
3✔
20
  end
21

22
  it "has expected header fields" do
1✔
23
    visit '/catalog/doi-10-34770-r75s-9j74'
1✔
24
    expect(page).to have_css '.document-title-heading'
×
25
    expect(page).to have_css '.authors-heading'
×
26
    expect(page).to have_css 'div.authors-heading > span.author-name'
×
27
    expect(page).to have_css '.issue-date-heading'
×
28
  end
29

30
  it "has expected metadata" do
1✔
31
    visit '/catalog/doi-10-34770-r75s-9j74'
1✔
32
    expect(page).to have_content "bitKlavier Grand Sample Library—Binaural Mic Image"
×
33
    author_top_of_page = '<span class="author-name">'
×
34
    author_popover_title = 'data-original-title="Trueman, Daniel"'
×
35
    author_popover_orcid = 'https://orcid.org/1234-1234-1234-1234'
×
36
    author_popover_affiliation = "<a href='/?f[authors_affiliation_ssim][]=Princeton+Plasma+Physics+Laboratory&amp;q=&amp;search_field=all_fields'>Princeton Plasma Physics Laboratory</a><br/>"
×
37
    author_meta = 'Trueman, Daniel (Princeton Plasma Physics Laboratory)'
×
38
    expect(page.html.include?(author_top_of_page)).to be true
×
39
    expect(page.html.include?(author_popover_title)).to be true
×
40
    expect(page.html.include?(author_popover_orcid)).to be true
×
41
    expect(page.html.include?(author_popover_affiliation)).to be true
×
42
    expect(page.html.include?(author_meta)).to be true
×
43
  end
44

45
  it "renders collection tags as links" do
1✔
46
    visit '/catalog/doi-10-34770-r75s-9j74'
1✔
47
    tag1 = "<a href=\"/?f[collection_tag_ssim][]=Humanities"
×
48
    tag2 = "<a href=\"/?f[collection_tag_ssim][]=Something+else"
×
49
    expect(page.html.include?(tag1)).to be true
×
50
    expect(page.html.include?(tag2)).to be true
×
51
  end
52

53
  # rubocop:disable Layout/LineLength
54
  xit "has expected citation information" do
1✔
55
    visit '/catalog/78348'
×
56
    apa_citation = "Stotler, D., F. Scotti, R.E. Bell, A. Diallo, B.P. LeBlanc, M. Podesta, A.L. Roquemore, & P.W. Ross. (2016). Midplane neutral density profiles in the National Spherical Torus Experiment [Data set]. Princeton Plasma Physics Laboratory, Princeton University."
×
57
    expect(page).to have_content apa_citation
×
58
    expect(page.html.include?('<button id="show-apa-citation-button"')).to be true
×
59
    expect(page.html.include?('<button id="show-bibtex-citation-button"')).to be true
×
60
  end
61
  # rubocop:enable Layout/LineLength
62

63
  xit "has expected HTML SPAN element with COinS information" do
1✔
64
    visit '/catalog/78348'
×
65
    expect(page.html.include?('<span class="Z3988"')).to be true
×
66
  end
67

68
  xit "renders pageviews and downloads stats" do
1✔
69
    visit '/catalog/78348'
×
70
    expect(page.html.include?('<span id="pageviews"')).to be true
×
71
    expect(page.html.include?('<span id="downloads"')).to be true
×
72
  end
73

74
  context "clickable links" do
1✔
75
    let(:globus_download_link) { "https://app.globus.org/file-manager?origin_id=dc43f461-0ca7-4203-848c-33a9fc00a464=%2Fvsj7-4j83%2F" }
1✔
76

77
    xit "renders hyperlinks in the abstract and description fields" do
1✔
78
      visit '/catalog/78348'
×
79
      expect(page.html.include?('<a href="http://torus.example.com">http://torus.example.com</a>')).to be true
×
80
      links = page.find("div.document-description").find_all("a").map { |a| a["href"] }
×
81
      expect(links.include?(globus_download_link)).to be true
×
82
    end
83
  end
84
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc