two_friends_in_same_other_list.t (1026B)
1 use strict; 2 use Test; 3 use SL::Test; 4 5 BEGIN { plan tests => 19 } 6 7 # this test makes sure that when 2 friends of yours are in the same list that 8 # your not in, that the list doesn't show up twice in your list_get_other 9 # request. 10 my $s = SL::Test::Server->new(); 11 12 my $A = SL::Test::Client->new(); 13 my $B = SL::Test::Client->new(); 14 my $C = SL::Test::Client->new(); 15 16 # A and B are mutual friends 17 $A->friend_add($B->phnum()); 18 $B->friend_add($A->phnum()); 19 20 # A and C are also mutual friends 21 $A->friend_add($C->phnum()); 22 $C->friend_add($A->phnum()); 23 24 # B and C need to be in the same list 25 my $list = $B->list_add({ name => 'this is Bs new list', date => 0 }); 26 $C->list_join($list->{num}); 27 28 # A makes sure he got a single list 29 my @other = @{ $A->lists_get_other() }; 30 ok( $other[0]->{num_members}, 2 ); 31 ok( $other[0]->{num}, $list->{num} ); 32 ok( scalar(@other), 1 ); 33 ok( ! grep {$_ eq $A->phnum()} @{$other[0]->{members}} ); 34 ok( grep {$_ eq $B->phnum()} @{$other[0]->{members}} ); 35 ok( grep {$_ eq $C->phnum()} @{$other[0]->{members}} );