Sha256: 2b8d483ed07f7245bdc0a51410d01c3609084b777cf5a041b606f14cbd52e7ba

Contents?: true

Size: 1.85 KB

Versions: 94

Compression:

Stored size: 1.85 KB

Contents

module ForestLiana
  class ValueStatGetterTest < ActiveSupport::TestCase
    test 'Value stat getter with a simple filter' do
      stat = ValueStatGetter.new(BooleanField, {
        type: "Value",
        collection: "boolean_field",
        timezone: "Europe/Paris",
        aggregate: "Count",
        filterType: "and",
        filters: [{
          field: "field",
          value: "true"
        }]
      })

      stat.perform
      assert stat.record.value[:countCurrent] == 0
    end

    test 'Value stat getter with a filter on a belongs_to integer field' do
      stat = ValueStatGetter.new(BelongsToField, {
        type: "Value",
        collection: "belongs_to_field",
        timezone: "Europe/Paris",
        aggregate: "Count",
        filterType: "and",
        filters: [{
          field: "has_one_field:id",
          value: "3"
        }]
      })

      stat.perform
      assert stat.record.value[:countCurrent] == 1
    end

    test 'Value stat getter with a filter on a belongs_to boolean field' do
      stat = ValueStatGetter.new(BelongsToField, {
        type: "Value",
        collection: "belongs_to_field",
        timezone: "Europe/Paris",
        aggregate: "Count",
        filterType: "and",
        filters: [{
          field: "has_one_field:checked",
          value: "false"
        }]
      })

      stat.perform
      assert stat.record.value[:countCurrent] == 0
    end

    test 'Value stat getter with a filter on a belongs_to enum field' do
      stat = ValueStatGetter.new(BelongsToField, {
        type: "Value",
        collection: "belongs_to_field",
        timezone: "Europe/Paris",
        aggregate: "Count",
        filterType: "and",
        filters: [{
          field: "has_one_field:status",
          value: "pending"
        }]
      })

      stat.perform
      assert stat.record.value[:countCurrent] == 1
    end
  end
end

Version data entries

94 entries across 94 versions & 1 rubygems

Version Path
forest_liana-3.3.0 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.2.0 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.1.1 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.1.0 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.7 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.6 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.5 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.4 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.3 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.2 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.1 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.0 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.0.pre.beta.18 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.0.pre.beta.17 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.0.pre.beta.16 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.0.pre.beta.15 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.0.pre.beta.14 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-2.15.8 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-3.0.0.pre.beta.13 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-2.15.7 test/services/forest_liana/value_stat_getter_test.rb