mirror of
https://github.com/internetee/registry.git
synced 2025-07-27 21:16:12 +02:00
Fixed test
This commit is contained in:
parent
a682681625
commit
045c74b7e2
2 changed files with 9 additions and 9 deletions
|
@ -55,7 +55,7 @@ module Repp
|
|||
end
|
||||
|
||||
def to_date(date_param)
|
||||
return if date_param.blank?
|
||||
return Date.today if date_param.blank?
|
||||
|
||||
Date.strptime(date_param, '%m.%y')
|
||||
end
|
||||
|
@ -114,19 +114,19 @@ module Repp
|
|||
.inject(:merge)
|
||||
end
|
||||
|
||||
def serialize_distribution_result(grouped)
|
||||
grouped.map do |key, value|
|
||||
def serialize_distribution_result(result)
|
||||
result.map do |key, value|
|
||||
next unless registrar_names.key?(key)
|
||||
|
||||
name = registrar_names[key]
|
||||
hash = { name: registrar_names[key], y: value }
|
||||
hash = { name: name, y: value }
|
||||
hash.merge!({ sliced: true, selected: true }) if current_user.registrar.name == name
|
||||
hash
|
||||
end
|
||||
end
|
||||
|
||||
def serialize_growth_rate_result(grouped)
|
||||
grouped.map do |key, value|
|
||||
def serialize_growth_rate_result(result)
|
||||
result.map do |key, value|
|
||||
next unless registrar_names.key?(key)
|
||||
|
||||
name = registrar_names[key]
|
||||
|
|
|
@ -21,15 +21,15 @@ class ReppV1StatsMarketShareTest < ActionDispatch::IntegrationTest
|
|||
|
||||
assert json[:data].is_a? Array
|
||||
assert json[:data][0].is_a? Hash
|
||||
assert_equal json[:data][0][:name], 'Best Names'
|
||||
assert json[:data][0][:selected]
|
||||
assert_equal json[:data][0][:name], 'Good Names'
|
||||
assert_nil json[:data][0][:selected]
|
||||
end
|
||||
|
||||
def test_shows_market_share_growth_rate_data
|
||||
prev_date = Time.zone.today.last_month.strftime('%m.%y')
|
||||
get '/repp/v1/stats/market_share_growth_rate', headers: @auth_headers,
|
||||
params: { q: { end_date: @today,
|
||||
compare_to_date: prev_date } }
|
||||
compare_to_end_date: prev_date } }
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert_response :ok
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue