Skip to content

Commit

Permalink
pagination component tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcam-src committed Jan 6, 2025
1 parent 0e55d5f commit 51b6064
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe Blacklight::FacetFieldPaginationComponent, type: :component do
let(:facet_field) { double('facet_field') }
let(:total_unique_facets) { 42 }

describe '#initialize' do
context 'when total_unique_facets is provided' do
it 'sets the facet_field and total_unique_facets attributes' do
component = Blacklight::FacetFieldPaginationComponent.new(facet_field: facet_field, total_unique_facets: total_unique_facets)

expect(component.facet_field).to eq(facet_field)
expect(component.total_unique_facets).to eq(total_unique_facets)
end
end

context 'when total_unique_facets is not provided' do
it 'sets the total_unique_facets attribute to nil' do
component = Blacklight::FacetFieldPaginationComponent.new(facet_field: facet_field)

expect(component.facet_field).to eq(facet_field)
expect(component.total_unique_facets).to be_nil
end
end
end
end

0 comments on commit 51b6064

Please sign in to comment.