Sha256: b7e443b45b2e6f2b9c4e035f14f220d1d47173b525154a947e4c6ef973d25b08
Contents?: true
Size: 1.31 KB
Versions: 34
Compression:
Stored size: 1.31 KB
Contents
require 'test_helper' module Workarea module Insights class CustomersAtRiskTest < TestCase def test_results Metrics::User.save_order(email: 'bcrouse0@workarea.com', revenue: 1.to_m, at: 60.days.ago) Metrics::User.save_order(email: 'bcrouse1@workarea.com', revenue: 1.to_m, at: 1.day.ago) Metrics::User.save_order(email: 'bcrouse2@workarea.com', revenue: 10.to_m, at: 2.days.ago) Metrics::User.save_order(email: 'bcrouse2@workarea.com', revenue: 10.to_m, at: 3.days.ago) Metrics::User.save_order(email: 'bcrouse3@workarea.com', revenue: 20.to_m, at: 2.days.ago) Metrics::User.save_order(email: 'bcrouse3@workarea.com', revenue: 20.to_m, at: 3.days.ago) Metrics::User.save_order(email: 'bcrouse3@workarea.com', revenue: 20.to_m, at: 4.days.ago) Metrics::User.save_order(email: 'bcrouse4@workarea.com', revenue: 30.to_m, at: 6.months.ago) Metrics::User.save_order(email: 'bcrouse4@workarea.com', revenue: 30.to_m, at: 6.months.ago) Metrics::User.update_aggregations! CustomersAtRisk.generate_monthly! assert_equal(1, CustomersAtRisk.count) at_risk = CustomersAtRisk.first assert_equal(1, at_risk.results.length) assert_equal('bcrouse4@workarea.com', at_risk.results.first['_id']) end end end end
Version data entries
34 entries across 34 versions & 1 rubygems