zeroclickinfo-goodies/t/MakeMeASandwich.t

44 lines
1.0 KiB
Perl
Raw Normal View History

#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Deep;
use DDG::Test::Goodie;
zci answer_type => 'xkcd_sandwich';
zci is_cached => 1;
my $yes = 'Okay.';
my $no = 'What? Make it yourself.';
sub build_test
{
my ($text, $input) = @_;
return test_zci($text, structured_answer => {
data => {
title => $text,
subtitle => [
$input,
{ text => "XKCD 149", href => "https://duckduckgo.com/?q=xkcd%20149"}
]
},
templates => {
group => 'text'
}
});
}
ddg_goodie_test(
['DDG::Goodie::MakeMeASandwich'],
'make me a sandwich' => build_test($no, "make me a sandwich"),
'MAKE ME A SANDWICH' => build_test($no, "make me a sandwich"),
'sudo make me a sandwich' => build_test($yes, "sudo make me a sandwich"),
'SUDO MAKE ME A SANDWICH' => build_test($yes, 'sudo make me a sandwich'),
2014-02-02 08:52:42 -08:00
'blahblah make me a sandwich' => undef,
'0 make me a sandwich' => undef,
);
2016-05-16 06:18:04 -07:00
done_testing;