Pārlūkot izejas kodu

Add unit tests for #67

George S. Baugh 10 gadi atpakaļ
vecāks
revīzija
0f91b0187b
1 mainītis faili ar 6 papildinājumiem un 2 dzēšanām
  1. 6 2
      t/TestRail-API.t

+ 6 - 2
t/TestRail-API.t

@@ -7,7 +7,7 @@ use lib "$FindBin::Bin/lib";
 use TestRail::API;
 use Test::LWP::UserAgent::TestRailMock;
 
-use Test::More tests => 76;
+use Test::More tests => 78;
 use Test::Fatal;
 use Test::Deep;
 use Scalar::Util ();
@@ -170,9 +170,13 @@ ok($statusTypes,"Can get possible test statuses");
 
 my @status_names = map {$_->{'name'}} @$statusTypes;
 my @status_ids = map {$_->{'id'}} @$statusTypes;
+my @status_labels = map {$_->{'label'}} @$statusTypes;
 my @computed_ids = $tr->statusNamesToIds(@status_names);
+my @computed_labels = $tr->statusNamesToLabels(@status_names);
 cmp_deeply(\@computed_ids,\@status_ids,"statusNamesToIds functions correctly");
-isnt(exception {$tr->statusNamesToIds(@status_names,'potzrebie'); }, undef, "Passing invalid status name throws exception");
+cmp_deeply(\@computed_labels,\@status_labels,"statusNamesToLabels functions correctly");
+isnt(exception {$tr->statusNamesToIds(@status_names,'potzrebie'); }, undef, "Passing invalid status name throws exception in statusNamesToIds");
+isnt(exception {$tr->statusNamesToLabels(@status_names,'potzrebie'); }, undef, "Passing invalid status name throws exception in statusNamesToLabels");
 
 #TODO make more thorough tests for options, custom options
 my $result = $tr->createTestResults($tests->[0]->{'id'},$statusTypes->[0]->{'id'},"REAPER FORCES INBOUND");