Sha256: 78e4e927954f70ad344694ad7eca9a2b0c22afd4569b1322a5e6582b90826fd2

Contents?: true

Size: 907 Bytes

Versions: 62

Compression:

Stored size: 907 Bytes

Contents

require 'test_helper'

module Workarea
  module Admin
    module Reports
      class AverageOrderValueViewModelTest < TestCase
        def test_graph_data
          Metrics::SalesByDay.inc(at: Time.zone.local(2016, 1, 1), orders: 2, revenue: 10)
          Metrics::SalesByDay.inc(at: Time.zone.local(2017, 1, 1), orders: 3, revenue: 9)

          travel_to Time.zone.local(2018, 1, 1)
          report = Workarea::Reports::AverageOrderValue.new(
            starts_at: 2.years.ago,
            group_by: 'year',
            sort_by: 'orders',
            sort_direction: 'asc'
          )
          view_model = AverageOrderValueViewModel.wrap(report)

          assert_equal(2, view_model.graph_data.size)
          assert_equal([5], view_model.graph_data[Time.zone.local(2016, 1, 1)])
          assert_equal([3], view_model.graph_data[Time.zone.local(2017, 1, 1)])
        end
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.5.27 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.5.26 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.4.45 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.5.25 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.5.23 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.4.44 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.5.22 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.4.43 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.5.21 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.4.42 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.5.20 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.4.41 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.5.19 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.4.40 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.5.18 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.4.39 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.5.17 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.4.38 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.5.16 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb
workarea-admin-3.4.37 test/view_models/workarea/admin/reports/average_order_value_view_model_test.rb