Sha256: 8f18ef0bdfa6268b9901f8ea5d3f7bcd22ae4a28d9de3d3fae8b667a0051d588

Contents?: true

Size: 1.88 KB

Versions: 66

Compression:

Stored size: 1.88 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",
        filters: {
          field: "field",
          operator: 'equal',
          value: "true"
        }.to_json
      })

      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",
        filters: {
          field: "has_one_field:id",
          operator: 'equal',
          value: 3
        }.to_json
      })

      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",
        filters: {
          field: "has_one_field:checked",
          operator: 'equal',
          value: "false"
        }.to_json
      })

      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",
        filters: {
          field: "has_one_field:status",
          operator: 'equal',
          value: "pending"
        }.to_json
      })

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

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
forest_liana-6.6.3 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-7.0.0.beta.4 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-7.0.0.beta.3 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.6.2 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.6.1 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.6.0 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.5.1 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-7.0.0.beta.2 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.5.0 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.4.1 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-7.0.0.beta.1 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.4.0 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.3.8 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.3.7 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.3.6 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.3.5 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.3.4 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.3.3 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.3.2 test/services/forest_liana/value_stat_getter_test.rb
forest_liana-6.3.1 test/services/forest_liana/value_stat_getter_test.rb