Sha256: 4aade3302880c980d1b1def519d0c364bab74116b04edc65b08a0f4e8076f6b7

Contents?: true

Size: 1.54 KB

Versions: 4

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'
require 'marc'

module BerkeleyLibrary
  module TIND
    module Mapping
      describe ExternalTindField do
        describe '# tind_fields_from_collection_information' do
          let(:good_hash) do
            {   '336' => ['Image'],
                '852' => ['East Asian Library'],
                '980' => ['pre_1912'],
                '982' => ['Pre 1912 Chinese Materials', 'Pre 1912 Chinese Materials'],
                '991' => [] }
          end
          let(:bad_hash) { {} }
          let(:output_collection_tags) { %w[336 852 980 982] }

          it 'get tind datafields derived from collection information' do
            expect(ExternalTindField.tind_fields_from_collection_information(good_hash).map(&:tag)).to eq output_collection_tags
          end

          it 'get [] derived from empty collection information' do
            expect { ExternalTindField.tind_fields_from_collection_information(bad_hash).map(&:tag) }.to raise_error(ArgumentError)
          end
        end

        describe '# tind_fields_from_alma_id' do
          let(:output_alma_tags) { %w[901 856] }

          it 'get derived tind fields from alma id' do
            alma_id = '991085821143406532'
            expect(ExternalTindField.tind_mms_id_fields(alma_id).map(&:tag)).to eq output_alma_tags
          end

          it 'get empty tind fields from a nil alma id' do
            alma_id = nil
            expect { ExternalTindField.tind_mms_id_fields(alma_id).map(&:tag) }.to raise_error(ArgumentError)
          end
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
berkeley_library-tind-0.7.2 spec/berkeley_library/tind/mapping/external_tind_field_spec.rb
berkeley_library-tind-0.7.1 spec/berkeley_library/tind/mapping/external_tind_field_spec.rb
berkeley_library-tind-0.7.0 spec/berkeley_library/tind/mapping/external_tind_field_spec.rb
berkeley_library-tind-0.6.0 spec/berkeley_library/tind/mapping/external_tind_field_spec.rb