aboutsummaryrefslogtreecommitdiff
path: root/test/test_ping.t
blob: c31c538c8b5d22d6c42b791c06dcd39b862951af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env perl

use strict;
use warnings;
use Test::Simple tests => 2;
use Mock::CommandRegistry;

use Plugin::Ping;

my $cr = new Mock::CommandRegistry;
my $register = sub { $cr->register(@_); };
Plugin::Ping->configure($register, undef, undef, undef);
ok($cr->is_registered_to_owner("Plugin::Ping", "ping"), "registered command");

my $pinger = "somelad";
my %ctx = (
	irc => undef,
	logger => undef,
	who => "$pinger!who\@example.com",
	where => undef,
	ided => undef,
	rest => undef,
	no_reenter => undef,
	args => undef
);
my $expected = "$pinger: pong";
my $response = $cr->run_owned("Plugin::Ping", "ping", %ctx);
ok($response eq $expected, "pong format correct");