Scramble: Switching to text template

master
Rob Emery 2016-05-19 12:51:53 +01:00
parent e71eb3c5d4
commit 386616d2d9
2 changed files with 25 additions and 15 deletions

View File

@ -46,12 +46,15 @@ handle remainder_lc => sub {
return unless $response;
return "$operation $word",
structured_answer => {
input => [html_enc($word)],
operation => $operation,
result => html_enc($response)
};
return "$operation $word", structured_answer => {
data => {
title => html_enc($response),
subtitle => html_enc("$operation: $word")
},
templates => {
group => 'text'
}
};
};
1;

View File

@ -9,18 +9,25 @@ use DDG::Test::Goodie;
zci answer_type => "scramble";
zci is_cached => 0;
sub build_test {
my ($text, $input) = @_;
return test_zci($text, structured_answer => {
data => {
title => ignore(),
subtitle => "Scramble of: $input"
},
templates => {
group => 'text'
}
});
}
ddg_goodie_test(
[qw( DDG::Goodie::Scramble )],
'scramble of filter' => test_zci(
'Scramble of filter',
structured_answer => {
input => ['filter'],
operation => 'Scramble of',
result => ignore(),
}
),
'scramble of filter' => build_test('Scramble of filter', 'filter'),
'scramble of' => undef,
'Scramble for' => undef,
'Scramble for' => undef,
'Scrambles for ""' => undef,
'Scrambles for "867-5309"' => undef,
);