aboutsummaryrefslogtreecommitdiff
path: root/test/test_thanks.t
diff options
context:
space:
mode:
authorDavid Phillips <david@yeah.nah.nz>2020-04-04 19:34:10 +1300
committerDavid Phillips <david@yeah.nah.nz>2020-04-04 19:36:42 +1300
commitcba83d93d8b47cc044e8d093049d23aba5d8b6ed (patch)
tree042fe5146cfef32a10c132a48292db8f29be7539 /test/test_thanks.t
parentcdae7275d29c9c370ec7e714dd71af2a1076c0d0 (diff)
downloadidalius-cba83d93d8b47cc044e8d093049d23aba5d8b6ed.tar.xz
Add test plans for Thanks, Vote
Diffstat (limited to 'test/test_thanks.t')
-rwxr-xr-xtest/test_thanks.t35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test_thanks.t b/test/test_thanks.t
new file mode 100755
index 0000000..680c235
--- /dev/null
+++ b/test/test_thanks.t
@@ -0,0 +1,35 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Test::Simple tests => 8;
+use Mock::CommandRegistry;
+
+use Plugin::Thanks;
+
+my @expected_commands = qw/thanks thanks. thanks! thanks?/;
+
+my $cr = new Mock::CommandRegistry;
+my $register = sub { $cr->register(@_); };
+Plugin::Thanks->configure($register, undef, undef, undef);
+for my $cmd (@expected_commands) {
+ my $is_registered = $cr->is_registered_to_owner("Plugin::Thanks", $cmd);
+ ok($is_registered, "registered command $cmd");
+}
+
+my $thanker = "somelad";
+my %ctx = (
+ irc => undef,
+ logger => undef,
+ who => "$thanker!who\@example.com",
+ where => undef,
+ ided => undef,
+ rest => undef,
+ no_reenter => undef,
+ args => undef
+);
+my $expected = "$thanker: pong";
+for my $cmd (@expected_commands) {
+ my $response = $cr->run_owned("Plugin::Thanks", $cmd, %ctx);
+ ok($response =~ m/^\Q$thanker\E: /, "response addressed to thanker");
+}