#!perl
use Cassandane::Tiny;

sub test_misc_creationids
    ($self)
{
    my $jmap = $self->{jmap};

    my $uid = 'ae2640cc-234a-4dd9-95cc-3106258445b9';

    xlog $self, "create and get contact group and contact";
    my $res = $jmap->CallMethods([
        ['ContactCard/set', {
            create => {
                "c1" => {
                    '@type' => 'Card',
                     version => '1.0',
                     name => { full => "foo" },
                     uid => $uid
                }
            }}, "R1"],
        ['ContactCard/set', {
            create => {
                "g1" => {
                    '@type' => 'Card',
                     version => '1.0',
                     name => { full => "group1" },
                     members => { $uid => JSON::true }
                }
            }}, "R2"],
        ['ContactCard/get', {ids => ["#c1"]}, "R3"],
        ['ContactCard/get', {ids => ["#g1"]}, "R4"],
    ]);
    my $contact = $res->[2][1]{list}[0];
    $self->assert_str_equals("foo", $contact->{name}{full});

    my $group = $res->[3][1]{list}[0];
    $self->assert_str_equals("group1", $group->{name}{full});

    $self->assert_not_null($group->{members}{$uid});
}
