From f3cf939ae59664145bb418115df52c95dee64194 Mon Sep 17 00:00:00 2001 From: gauravano Date: Wed, 17 Jan 2018 03:07:45 +0530 Subject: [PATCH] Functional test added --- test/functional/search_api_test.rb | 40 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/test/functional/search_api_test.rb b/test/functional/search_api_test.rb index 75a0c50b29..1c7695906c 100644 --- a/test/functional/search_api_test.rb +++ b/test/functional/search_api_test.rb @@ -25,7 +25,7 @@ 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 @@ -33,25 +33,25 @@ def app 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