From 299a97707a9959794bc3e83f2bf584ed54f55b16 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Mon, 4 Mar 2024 15:11:27 -0800 Subject: [PATCH] Update spec for new cases --- spec/doi_checker_spec.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/spec/doi_checker_spec.rb b/spec/doi_checker_spec.rb index 5614c5cd..43461491 100644 --- a/spec/doi_checker_spec.rb +++ b/spec/doi_checker_spec.rb @@ -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) @@ -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