Skip to content

Commit

Permalink
Update spec for new cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakers-the-rat committed Mar 4, 2024
1 parent 4000ff3 commit 299a977
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions spec/doi_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@
expect(doi_summary[:missing][0]).to eq("Errored finding suggestions for \"#{expected_title}\", please try later")
end

it "should ignore entries no DOI and no crossref alternative" do
missing_doi = BibTeX::Entry.new({title: "No DOI"})
it "should report entries with no DOI and no crossref alternative as missing DOIs" do
title = "No DOI"
missing_doi = BibTeX::Entry.new({title: title})
doi_checker = DOIChecker.new([missing_doi])

expect(doi_checker).to receive(:crossref_lookup).with("No DOI").and_return(nil)
Expand All @@ -92,7 +93,17 @@

expect(doi_summary[:ok]).to be_empty
expect(doi_summary[:invalid]).to be_empty
expect(doi_summary[:missing]).to be_empty
expect(doi_summary[:missing][0]).to eq("No DOI given, and none found for title: #{title}")
end

it "should report entries with no DOI or title as missing both" do
entry = BibTex::Entry.new(journal: "A Well Respected Journal")
doi_checker = DOIChecker.new([entry])

doi_summary = doi_checker.check_dois
expect(doi_summary[:ok]).to be_empty
expect(doi_summary[invalid]).to be_empty
expect(doi_summary[:missing][0]).to eq("No DOI or title given for entry #{entry.to_s}")
end
end

Expand Down

0 comments on commit 299a977

Please sign in to comment.