Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
maricavor committed Aug 25, 2022
1 parent a471e29 commit 54f3548
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/integration/repp/v1/stats/market_share_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
require 'test_helper'

class ReppV1StatsMarketShareTest < ActionDispatch::IntegrationTest
def setup
@user = users(:api_bestnames)
token = Base64.encode64("#{@user.username}:#{@user.plain_text_password}")
token = "Basic #{token}"

@auth_headers = { 'Authorization' => token }
end

def test_shows_market_share_data
get '/repp/v1/stats/market_share', headers: @auth_headers
json = JSON.parse(response.body, symbolize_names: true)

assert_response :ok
assert_equal 1000, json[:code]
assert_equal 'Command completed successfully', json[:message]

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]
end
end

0 comments on commit 54f3548

Please sign in to comment.