mirror of
https://github.com/internetee/registry.git
synced 2025-07-30 14:36:22 +02:00
Added additional tests to REPP API
This commit is contained in:
parent
b505de2f0f
commit
b502c2779e
21 changed files with 796 additions and 7 deletions
|
@ -64,4 +64,32 @@ class ReppV1DomainsListTest < ActionDispatch::IntegrationTest
|
|||
serialized_domain = Serializers::Repp::Domain.new(domain).to_json
|
||||
assert_equal serialized_domain.as_json, json[:data][:domain].as_json
|
||||
end
|
||||
|
||||
def test_returns_detailed_registrar_domains_by_search_query
|
||||
search_params = {
|
||||
name_matches: '%library%',
|
||||
}
|
||||
get repp_v1_domains_path(details: true, q: search_params), headers: @auth_headers
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert_response :ok
|
||||
|
||||
assert_equal json[:data][:domains].length, 1
|
||||
assert json[:data][:domains][0].is_a? Hash
|
||||
end
|
||||
|
||||
def test_returns_detailed_registrar_domains_by_sort_query
|
||||
domain = domains(:shop)
|
||||
sort_params = {
|
||||
s: 'name desc',
|
||||
}
|
||||
get repp_v1_domains_path(details: true, q: sort_params), headers: @auth_headers
|
||||
json = JSON.parse(response.body, symbolize_names: true)
|
||||
|
||||
assert_response :ok
|
||||
|
||||
assert_equal @user.registrar.domains.count, json[:data][:count]
|
||||
assert_equal @user.registrar.domains.count, json[:data][:domains].length
|
||||
assert_equal json[:data][:domains][0][:name], domain.name
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue