Browse Source

Add offset tests for get_member_votes

master
Blaine Motsinger 2 years ago
parent
commit
c30fe45783
  1. 12
      t/lib-ProPublica-Congress-Members/get_member_votes.t

12
t/lib-ProPublica-Congress-Members/get_member_votes.t

@ -30,7 +30,7 @@ HAPPY_PATH: {
note( 'happy path' );
my $members_obj = ProPublica::Congress::Members->new( key => 'unitTESTkey' );
my $votes = $members_obj->get_member_votes( member_id => 'ABC123' );
my $votes = $members_obj->get_member_votes( member_id => 'ABC123', offset => 20 );
is_deeply( $votes, { json => 'data' }, 'returned contains expected data' );
}
@ -50,6 +50,16 @@ EXCEPTIONS: {
'dies if member_id argument contains non alpha numeric chars';
like $@, qr/The member_id argument must be a string of alpha numeric characters/,
'exception indicates member_id must be a string of alpha numeric characters';
note( 'offset values' );
lives_ok { $members_obj->get_member_votes( member_id => 'ABC123' ) }
'lives if offset argument is missing';
dies_ok { $members_obj->get_member_votes( member_id => 'ABC123', offset => '' ) }
'dies if offset argument is empty string';
dies_ok { $members_obj->get_member_votes( member_id => 'ABC123', offset => '21' ) }
'dies if offset argument is not multiple of 20';
like $@, qr/The offset argument must be a multiple of 20/,
'exception indicates offset must be a multiple of 20';
}
done_testing();

Loading…
Cancel
Save