Skip to content

Commit

Permalink
Functional test added
Browse files Browse the repository at this point in the history
  • Loading branch information
grvsachdeva committed Jan 16, 2018
1 parent 101be0d commit f3cf939
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions test/functional/search_api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,33 @@ def app
assert_equal nodes(:blog).path, json['items'][0]['docUrl']
assert_equal "Blog post", json['items'][0]['docTitle']
assert_equal 13, json['items'][0]['docId']

assert matcher =~ json

end

test 'search nearby nodes functionality' do
get '/api/srch/locations?srchString=71.00,52.00'
assert last_response.ok?
#
# # Expected search pattern
# pattern = {
# srchParams: {
# srchString: '71.00,52.00',
# seq: nil,
# }.ignore_extra_keys!
# }.ignore_extra_keys!
#
# matcher = JsonExpressions::Matcher.new(pattern)
#
# json = JSON.parse(last_response.body)
#
# assert_equal nodes(:map).path, json['items'][0]['docUrl']
# assert_equal "A map page", json['items'][0]['docTitle']
# assert_equal 12, json['items'][0]['docId']
#
# assert matcher =~ json
#

# Expected search pattern
pattern = {
srchParams: {
srchString: '71.00,52.00',
seq: nil,
}.ignore_extra_keys!
}.ignore_extra_keys!

matcher = JsonExpressions::Matcher.new(pattern)

json = JSON.parse(last_response.body)

assert_equal nodes(:blog).path, json['items'][0]['docUrl']
assert_equal "Blog post", json['items'][0]['docTitle']
assert_equal 13, json['items'][0]['docId']

assert matcher =~ json

end

end

0 comments on commit f3cf939

Please sign in to comment.