Sha256: a5fc01fc9977188c142f4cc0243ce73a024f9b1c21db467dcb2fb4fd6fa507e3

Contents?: true

Size: 920 Bytes

Versions: 62

Compression:

Stored size: 920 Bytes

Contents

require 'test_helper'

module Workarea
  module Admin
    module Dashboards
      class PeopleViewModelTest < TestCase
        def test_new_vs_returning
          Metrics::SalesByDay.inc(at: Time.zone.local(2019, 1, 2), orders: 5, returning_orders: 1)
          Metrics::SalesByDay.inc(at: Time.zone.local(2019, 1, 9), orders: 15, returning_orders: 5)
          travel_to Time.zone.local(2019, 1, 10)

          view_model = PeopleViewModel.new
          assert_equal([10, 5], view_model.new_vs_returning_pie_graph_data.values)
          assert_equal(
            { Date.new(2019, 1, 3) => 0, Date.new(2019, 1, 9) => 10 },
            view_model.new_vs_returning_line_graph_data.first[:data]
          )
          assert_equal(
            { Date.new(2019, 1, 3) => 0, Date.new(2019, 1, 9) => 5 },
            view_model.new_vs_returning_line_graph_data.second[:data]
          )
        end
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.4.27 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.5.4 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.4.26 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.5.3 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.4.25 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.5.2 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.4.24 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.5.1 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.4.23 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.4.22 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.5.0 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.4.21 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.5.0.beta.1 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.4.20 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.4.19 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.4.18 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.4.17 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.4.16 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.4.15 test/view_models/workarea/admin/dashboards/people_view_model_test.rb
workarea-admin-3.4.14 test/view_models/workarea/admin/dashboards/people_view_model_test.rb