#!perl
use Cassandane::Tiny;

sub test_contact_set_issue2953
    :min_version_3_1
{
    my ($self) = @_;

    my $jmap = $self->{jmap};

    xlog $self, "create contacts";
    my $res = $jmap->CallMethods([
        ['Contact/set', {
            create => {
                1 => {
                    online => [{
                        type => 'username',
                        value => 'foo,bar',
                        label => 'Github',
                    }],
                },
            },
        }, 'R1'],
        ['Contact/get', {
            ids => ['#1'], properties => ['online'],
        }, 'R2'],
    ]);
    $self->assert_not_null($res->[0][1]{created}{1});
    $self->assert_str_equals('foo,bar', $res->[1][1]{list}[0]{online}[0]{value});
}
