Sha256: cc420fb9e54bc35466bf7a8be10d5e5ad84c27a879d960d108daff25a763f43a

Contents?: true

Size: 1.45 KB

Versions: 28

Compression:

Stored size: 1.45 KB

Contents

require 'test_helper'

module Workarea
  module Insights
    class LowAovCustomersTest < TestCase
      def test_results
        Metrics::User.save_order(email: 'bcrouse1@workarea.com', revenue: 10.to_m)
        Metrics::User.save_order(email: 'bcrouse1@workarea.com', revenue: 10.to_m)
        Metrics::User.save_order(email: 'bcrouse2@workarea.com', revenue: 20.to_m)
        Metrics::User.save_order(email: 'bcrouse2@workarea.com', revenue: 20.to_m)
        Metrics::User.save_order(email: 'bcrouse3@workarea.com', revenue: 3.to_m)
        Metrics::User.save_order(email: 'bcrouse3@workarea.com', revenue: 3.to_m)
        Metrics::User.save_order(email: 'bcrouse3@workarea.com', revenue: 3.to_m)
        Metrics::User.save_order(email: 'bcrouse4@workarea.com', revenue: 40.to_m)
        Metrics::User.save_order(email: 'bcrouse5@workarea.com', revenue: 5.to_m, at: 60.days.ago)
        Metrics::User.save_order(email: 'bcrouse5@workarea.com', revenue: 5.to_m, at: 60.days.ago)
        Metrics::User.save_order(email: 'bcrouse5@workarea.com', revenue: 5.to_m, at: 60.days.ago)

        Metrics::UpdateUserAggregations.update!

        LowAovCustomers.generate_monthly!
        assert_equal(1, LowAovCustomers.count)
        low_aov = LowAovCustomers.first
        assert_equal(1, low_aov.results.length)
        assert_equal('bcrouse3@workarea.com', low_aov.results.first['_id'])
        assert_equal(3, low_aov.results.first['average_order_value'])
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-core-3.5.6 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.5.5 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.5.4 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.5.3 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.5.2 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.5.1 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.5.0 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.5.0.beta.1 test/models/workarea/insights/low_aov_customers_test.rb