Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue-1602 Added test case for normalizing ORCID ids with and withou … #164

Merged
merged 5 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions spec/author_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,10 @@
end

context "affiliationIdentifier" do
let(:input) { fixture_path + 'datacite-example-ROR-nameIdentifiers.xml' }
subject { Bolognese::Metadata.new(input: input, from: "datacite") }

it "should normalize ROR affiliationIdentifier with and without URL" do
input = fixture_path + 'datacite-example-ROR-nameIdentifiers.xml'
subject = Bolognese::Metadata.new(input: input, from: "datacite")
# without URL inside affiliationIdentifier="05bp8ka77"
ror_affiliater0 = subject.creators[0]["affiliation"].select { |r| r["affiliationIdentifierScheme"] == "ROR" }
expect(ror_affiliater0[0]["affiliationIdentifier"]).to eq("https://ror.org/05bp8ka77")
Expand All @@ -184,6 +185,18 @@
expect(ror_affiliater1[0]["affiliationIdentifier"]).to eq("https://ror.org/05bp8ka05")
end

it "should normalize the valid ORCID nameIdentifier to URL with schemeURI" do
# with "schemeURI"
# ORICD normalization 0000-0001-9998-0117 => https://orcid.org/0000-0001-9998-0117
expect(subject.creators[0]["nameIdentifiers"]).to eq([{"nameIdentifier"=>"https://orcid.org/0000-0001-9998-0117", "schemeUri"=>"https://orcid.org", "nameIdentifierScheme"=>"ORCID"}])
end

it "should normalize the valid ORCID nameIdentifier to URL without schemeURI" do
# without "schemeURI"
# ORICD normalization 0000-0001-9998-0117 => https://orcid.org/0000-0001-9998-0117
expect(subject.creators[7]["nameIdentifiers"]).to eq([{"nameIdentifier"=>"https://orcid.org/0000-0001-9998-0117", "schemeUri"=>"https://orcid.org", "nameIdentifierScheme"=>"ORCID"}])
end

it "should parse non ROR schema's without normalizing them" do
input = fixture_path + 'datacite-example-ROR-nameIdentifiers.xml'
subject = Bolognese::Metadata.new(input: input, from: "datacite")
Expand Down
6 changes: 5 additions & 1 deletion spec/fixtures/datacite-example-ROR-nameIdentifiers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<creators>
<creator>
<creatorName nameType="Personal">Ashwini Sukale</creatorName>
<nameIdentifier schemeURI="https://orcid.org/" nameIdentifierScheme="ORCID"> https://orcid.org/0000-0001-9998-0117 </nameIdentifier>
<nameIdentifier schemeURI="https://orcid.org/" nameIdentifierScheme="ORCID">0000-0001-9998-0117</nameIdentifier>
<affiliation affiliationIdentifier="05bp8ka77" affiliationIdentifierScheme="ROR"> Metadata Game Changers </affiliation>
<affiliation affiliationIdentifier="grid.268117.b" affiliationIdentifierScheme="GRID">Wesleyan University</affiliation>
</creator>
Expand Down Expand Up @@ -35,6 +35,10 @@
<creatorName nameType="Organizational">جامعة زاخۆ</creatorName>
<nameIdentifier nameIdentifierScheme="RORS" schemeURI="https://ror.org">05sd1pz50</nameIdentifier>
</creator>
<creator>
<creatorName nameType="Personal">Ashwini S</creatorName>
<nameIdentifier nameIdentifierScheme="ORCID">0000-0001-9998-0117</nameIdentifier>
</creator>
</creators>
<titles>
<title xml:lang="en-US">Genomic Standards Consortium (GSC) Island Sampling Day: Moorea Reef to Ridges Genomic Transect</title>
Expand Down