Sha256: 56d1cd77eb4abc370c46f3a50be53b609e7bc652b8a6f8c20d7ad40f2db565eb

Contents?: true

Size: 1022 Bytes

Versions: 25

Compression:

Stored size: 1022 Bytes

Contents

require 'test_helper'
class FacetTest < Test::Unit::TestCase
  def test_new
    facet = Exlibris::Primo::Facet.new(:raw_xml => "<FACET NAME=\"creator\" COUNT=\"3\">"+
      "<FACET_VALUES KEY=\"Author1, FirstName\" VALUE=\"3\"/>"+
      "<FACET_VALUES KEY=\"Author2, FirstName\" VALUE=\"1\"/>"+
      "</FACET>")
    assert_equal "creator", facet.name
    assert_equal "creator", facet.display_name
    assert_equal 3, facet.size
    assert_equal 2, facet.facet_values.size
  end

  def test_facet_label
    Exlibris::Primo.configure do |config|
      config.facet_labels = {"lcc" => "LC Subject Headings"}
    end
    facet = Exlibris::Primo::Facet.new(:raw_xml => "<FACET NAME=\"lcc\" COUNT=\"3\">"+
      "<FACET_VALUES KEY=\"A. Some Value\" VALUE=\"3\"/>"+
      "<FACET_VALUES KEY=\"B. Some Other Value\" VALUE=\"1\"/>"+
      "</FACET>")
    assert_equal "lcc", facet.name
    assert_equal "LC Subject Headings", facet.display_name
    assert_equal 3, facet.size
    assert_equal 2, facet.facet_values.size
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
exlibris-primo-1.0.4 test/facet_test.rb
exlibris-primo-1.0.3 test/facet_test.rb
exlibris-primo-1.0.2 test/facet_test.rb
exlibris-primo-1.0.1 test/facet_test.rb
exlibris-primo-1.0.0 test/facet_test.rb