Add structured_answer builder template to tests
parent
1b9b7a61ac
commit
5a1b1293f4
|
@ -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