# frozen_string_literal: true
require 'spec_helper'
describe Briard::Metadata, vcr: true do
context 'write metadata as citation' do
it 'Journal article' do
input = '10.7554/eLife.01567'
subject = described_class.new(input: input, from: 'crossref')
expect(subject.style).to eq('apa')
expect(subject.locale).to eq('en-US')
expect(subject.citation).to eq('Sankar, M., Nieminen, K., Ragni, L., Xenarios, I., & Hardtke, C. S. (2014). Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth. ELife, 3, e01567. https://doi.org/10.7554/elife.01567')
end
it 'Journal article vancouver style' do
input = '10.7554/eLife.01567'
subject = described_class.new(input: input, from: 'crossref', style: 'vancouver',
locale: 'en-US')
expect(subject.style).to eq('vancouver')
expect(subject.locale).to eq('en-US')
expect(subject.citation).to eq('Sankar M, Nieminen K, Ragni L, Xenarios I, Hardtke CS. Automated quantitative histology reveals vascular morphodynamics during Arabidopsis hypocotyl secondary growth. eLife [Internet]. 2014Feb11;3:e01567. Available from: https://elifesciences.org/articles/01567')
end
it 'Dataset' do
input = 'https://doi.org/10.5061/DRYAD.8515'
subject = described_class.new(input: input, from: 'datacite')
expect(subject.citation).to eq('Ollomo, B., Durand, P., Prugnolle, F., Douzery, Emmanuel J. P., Arnathau, C., Nkoghe, D., Leroy, E., & Renaud, F. (2011). Data from: A new malaria agent in African hominids. (Version 1) [Data set]. Dryad. https://doi.org/10.5061/dryad.8515')
end
it 'Missing author' do
input = 'https://doi.org/10.3390/publications6020015'
subject = described_class.new(input: input, from: 'crossref')
expect(subject.citation).to eq('Kohls, A., & Mele, S. (2018). Converting the Literature of a Scientific Field to Open Access through Global Collaboration: The Experience of SCOAP3 in Particle Physics. Publications, 6(2), 15. https://doi.org/10.3390/publications6020015')
end
it 'software w/version' do
input = 'https://doi.org/10.5281/zenodo.2598836'
subject = described_class.new(input: input, from: 'datacite')
expect(subject.style).to eq('apa')
expect(subject.locale).to eq('en-US')
expect(subject.citation).to eq('Lab for Exosphere and Near Space Environment Studies. (2019). lenses-lab/LYAO_RT-2018JA026426: Original Release (Version 1.0.0) [Computer software]. Zenodo. https://doi.org/10.5281/zenodo.2598836')
end
it 'interactive resource without dates' do
input = 'https://doi.org/10.34747/g6yb-3412'
subject = described_class.new(input: input, from: 'datacite')
expect(subject.style).to eq('apa')
expect(subject.locale).to eq('en-US')
expect(subject.citation).to eq('Clark, D. (2019). Exploring the "Many analysts, one dataset" project from COS. Gigantum, Inc. https://doi.org/10.34747/g6yb-3412')
end
end
end