Sha256: d8e7c8c6179066227cea4a3d88a5fabc8b7a4a2acd57e3c77f4df3410feb14d0

Contents?: true

Size: 1.08 KB

Versions: 62

Compression:

Stored size: 1.08 KB

Contents

require 'test_helper'

module Workarea
  class BulkActionSelectionsTest < TestCase
    include SearchIndexing

    def test_results
      products = Array.new(10) { |i| create_product(name: "Test Product #{i}") }
      products.each { |p| Search::Admin.for(p).save }

      action = create_bulk_action_product_edit()
      action.set(ids: []) # remove ids added on save to simulate query-based action
      query = BulkActionSelections.new(action.id)

      assert_equal(10, query.results.size)
      assert_equal(1, query.results.total_pages)

      action = create_bulk_action_product_edit(
        exclude_ids: products.first(6).map(&:to_global_id).map(&:to_param)
      )
      query = BulkActionSelections.new(action.id)

      assert_equal(4, query.results.size)
      assert_equal(1, query.results.total_pages)

      action = create_bulk_action_product_edit(
        ids: products.first(6).map(&:to_global_id).map(&:to_param),
      )
      query = BulkActionSelections.new(action.id)

      assert_equal(6, query.results.size)
      assert_equal(1, query.results.total_pages)
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.5.26 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.4.45 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.5.25 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.5.23 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.4.44 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.5.22 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.4.43 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.5.21 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.4.42 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.5.20 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.4.41 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.5.19 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.4.40 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.5.18 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.4.39 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.5.17 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.4.38 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.5.16 test/queries/workarea/bulk_action_selections_test.rb
workarea-core-3.4.37 test/queries/workarea/bulk_action_selections_test.rb