Sha256: e0fb6051abbf9650bd7ccff197a23a55043f220d85f69ee62b2c0e87bdcf58b9

Contents?: true

Size: 1.44 KB

Versions: 34

Compression:

Stored size: 1.44 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::User.update_aggregations!

        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

34 entries across 34 versions & 1 rubygems

Version Path
workarea-core-3.4.45 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.44 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.43 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.42 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.41 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.40 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.39 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.38 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.37 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.36 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.35 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.34 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.33 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.32 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.31 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.30 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.29 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.28 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.27 test/models/workarea/insights/low_aov_customers_test.rb
workarea-core-3.4.26 test/models/workarea/insights/low_aov_customers_test.rb