diff --git a/lib/DDG/Goodie/DuckDuckGo.pm b/lib/DDG/Goodie/DuckDuckGo.pm index 66007b86a..4f40c3a14 100644 --- a/lib/DDG/Goodie/DuckDuckGo.pm +++ b/lib/DDG/Goodie/DuckDuckGo.pm @@ -67,7 +67,11 @@ handle remainder => sub { my $response = $responses->{$key}; return unless ($response); - return $response->{text}, html => $response->{html}; + return $response->{text}, + structured_answer => { + input => [], + operation => 'DuckDuckGo info', + result => $response->{html}}; }; 1; diff --git a/t/DuckDuckGo.t b/t/DuckDuckGo.t index ade83a87c..c16901c4c 100644 --- a/t/DuckDuckGo.t +++ b/t/DuckDuckGo.t @@ -9,28 +9,64 @@ zci answer_type => 'duckduckgo'; zci is_cached => 1; # The results should be static, so these facilitate easier testing of triggers. -my @about_result = - ("DuckDuckGo's about page: https://duckduckgo.com/about", html => "DuckDuckGo's about page."); -my @blog_result = ("DuckDuckGo's official blog: https://duck.co/blog", html => "DuckDuckGo's official blog."); -my @help_result = - ("Need help? Visit our help page: http://dukgo.com/help/", html => "Need help? Visit our help page."); +my @about_result = ( + "DuckDuckGo's about page: https://duckduckgo.com/about", + structured_answer => { + input => [], + operation => 'DuckDuckGo info', + result => "DuckDuckGo's about page." + }); +my @blog_result = ( + "DuckDuckGo's official blog: https://duck.co/blog", + structured_answer => { + input => [], + operation => 'DuckDuckGo info', + result => "DuckDuckGo's official blog." + }); +my @help_result = ( + "Need help? Visit our help page: http://dukgo.com/help/", + structured_answer => { + input => [], + operation => 'DuckDuckGo info', + result => "Need help? Visit our help page." + }); my @irc_result = ( "DuckDuckGo's official IRC channel is #duckduckgo on irc.freenode.net.", - html => - "DuckDuckGo's official IRC channel is #duckduckgo on irc.freenode.net" -); + structured_answer => { + input => [], + operation => 'DuckDuckGo info', + result => + "DuckDuckGo's official IRC channel is #duckduckgo on irc.freenode.net" + }); my @merch_result = ( "Thanks for the support! Check out the DuckDuckGo store for t-shirts, stickers, and other items: https://duck.co/help/community/swag", - html => - "Thanks for the support! Check out the DuckDuckGo store for t-shirts, stickers, and other items." -); -my @tor_result = - ("DuckDuckGo's service on Tor: http://3g2upl4pq6kufc4m.onion", html => "DuckDuckGo's service on Tor."); -my @shorturl_result = ("DuckDuckGo's short URL: http://ddg.gg/", html => "DuckDuckGo's short URL: http://ddg.gg/."); + structured_answer => { + input => [], + operation => 'DuckDuckGo info', + result => + "Thanks for the support! Check out the DuckDuckGo store for t-shirts, stickers, and other items." + }); +my @tor_result = ( + "DuckDuckGo's service on Tor: http://3g2upl4pq6kufc4m.onion", + structured_answer => { + input => [], + operation => 'DuckDuckGo info', + result => "DuckDuckGo's service on Tor." + }); +my @shorturl_result = ( + "DuckDuckGo's short URL: http://ddg.gg/", + structured_answer => { + input => [], + operation => 'DuckDuckGo info', + result => "DuckDuckGo's short URL: http://ddg.gg/." + }); my @zci_result = ( "Zero Click Info is the term DuckDuckGo uses for these boxes, which often provide useful instant answers above traditional results.", - html => "Zero Click Info is the term DuckDuckGo uses for these boxes, which often provide useful instant answers above traditional results." -); + structured_answer => { + input => [], + operation => 'DuckDuckGo info', + result => "Zero Click Info is the term DuckDuckGo uses for these boxes, which often provide useful instant answers above traditional results." + }); ddg_goodie_test( [qw( DDG::Goodie::DuckDuckGo )],