Merge pull request #2802 from duckduckgo/gd/templates-remove-id-name
Remove ID and name from templatesmaster
commit
3187298e65
|
@ -35,15 +35,6 @@ handle <: $ia_handler :> => sub {
|
|||
return "plain text response",
|
||||
structured_answer => {
|
||||
|
||||
# ID - Must be unique and match Instant Answer page
|
||||
# E.g. https://duck.co/ia/view/calculator has `id => 'calculator'``
|
||||
id => '<: $ia_id :>',
|
||||
|
||||
# Name - Used for Answer Bar Tab
|
||||
# Value should be chosen from existing Instant Answer topics
|
||||
# see http://docs.duckduckhack.com/frontend-reference/display-reference.html#name-string-required
|
||||
name => 'Answer',
|
||||
|
||||
data => {
|
||||
title => "My Instant Answer Title",
|
||||
subtitle => "My Subtitle",
|
||||
|
|
|
@ -21,15 +21,6 @@ handle <: $ia_handler :> => sub {
|
|||
return "plain text response",
|
||||
structured_answer => {
|
||||
|
||||
# ID - Must be unique and match Instant Answer page
|
||||
# E.g. https://duck.co/ia/view/calculator has `id => 'calculator'``
|
||||
id => '<: $ia_id :>',
|
||||
|
||||
# Name - Used for Answer Bar Tab
|
||||
# Value should be chosen from existing Instant Answer topics
|
||||
# see https://duck.co/duckduckhack/display_reference#codenamecode-emstringem-required
|
||||
name => 'Answer',
|
||||
|
||||
data => {
|
||||
<: $ia_handler :> => \<: $ia_handler_var :>_
|
||||
},
|
||||
|
|
|
@ -17,8 +17,6 @@ DDH.<: $ia_id :> = DDH.<: $ia_id :> || {};
|
|||
|
||||
return {
|
||||
|
||||
id: '<: $ia_id :>',
|
||||
|
||||
meta: {
|
||||
sourceName: "Source Domain",
|
||||
sourceUrl: "https://source.website.com"
|
||||
|
|
|
@ -8,12 +8,38 @@ use DDG::Test::Goodie;
|
|||
zci answer_type => "<: $ia_id :>";
|
||||
zci is_cached => 1;
|
||||
|
||||
# Build a structured answer that should match the response from the
|
||||
# Perl file.
|
||||
sub build_structured_answer {
|
||||
my @test_params = @_;
|
||||
|
||||
return "plain text response",
|
||||
structured_answer => {
|
||||
|
||||
data => {
|
||||
title => "My Instant Answer Title",
|
||||
subtitle => "My Subtitle",
|
||||
# image => "http://website.com/image.png"
|
||||
},
|
||||
|
||||
templates => {
|
||||
group => "text",
|
||||
# options => {
|
||||
#
|
||||
# }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
# Use this to build expected results for your tests.
|
||||
sub build_test { test_zci(build_structured_answer(@_)) }
|
||||
|
||||
ddg_goodie_test(
|
||||
[qw( DDG::Goodie::<: $ia_package_name :> )],
|
||||
# At a minimum, be sure to include tests for all:
|
||||
# - primary_example_queries
|
||||
# - secondary_example_queries
|
||||
'example query' => test_zci('query'),
|
||||
'example query' => build_test('query'),
|
||||
# Try to include some examples of queries on which it might
|
||||
# appear that your answer will trigger, but does not.
|
||||
'bad example query' => undef,
|
||||
|
|
Loading…
Reference in New Issue