#!perl use Cassandane::Tiny; sub test_contactgroup_get_deduplicate_contactids :min_version_3_7 { my ($self) = @_; my $jmap = $self->{jmap}; my $carddav = $self->{carddav}; # define duplicate ids my @ids = qw ( b48259ca-1524-4df0-af54-e65f60bf27b5 b48259ca-1524-4df0-af54-e65f60bf27b5 2391c8ef-1cfc-40da-8730-cb5664005973 b48259ca-1524-4df0-af54-e65f60bf27b5 f1fc45d4-809a-4d10-8abd-2bfc84dcab8c 2391c8ef-1cfc-40da-8730-cb5664005973 ); # deduplicate ids my %idhash = map { $_, 1 } @ids; my @wantids = sort keys %idhash; my @wantOtherAccountIds = qw (5b3b9ce1-0b5e-4cbd-8add-018321cad51b); xlog $self, "create a v3 contact group with duplicate members"; my $id = '816ad14a-f9ef-43a8-9039-b57bf321de1f'; my $href = "Default/$id.vcf"; my $vgroup = <Request('PUT', $href, $vgroup, 'Content-Type' => 'text/vcard'); my $res = $jmap->CallMethods([ ['ContactGroup/get', { properties => ['contactIds', 'otherAccountContactIds' ], }, 'R1'] ]); my @gotids = sort @{$res->[0][1]{list}[0]{contactIds}}; xlog "Assert contactIds in group got deduplicated"; $self->assert_deep_equals(\@wantids, \@gotids); xlog "Assert otherAccountContactIds got deduplicated"; $self->assert_deep_equals({ foo => \@wantOtherAccountIds }, $res->[0][1]{list}[0]{otherAccountContactIds}); }