formatting
This commit is contained in:
parent
250bd940da
commit
8e5df8fbf0
@ -14,7 +14,9 @@ subtest basic => sub {
|
||||
my $s = $registry->serialize(
|
||||
'thing',
|
||||
{ id => 1,
|
||||
subthings => [ { id => 2, x => 10 }, { id => 3 } ] } );
|
||||
subthings => [ { id => 2, x => 10 }, { id => 3 } ]
|
||||
}
|
||||
);
|
||||
|
||||
ok not $s->{data}{attributes};
|
||||
|
||||
@ -26,21 +28,25 @@ subtest basic => sub {
|
||||
{ subthings => { data => [ { id => 2 }, { id => 3 } ] } }
|
||||
},
|
||||
included =>
|
||||
[ { type => 'subthing', id => 2, attributes => { x => 10 } }, ] };
|
||||
[ { type => 'subthing', id => 2, attributes => { x => 10 } }, ]
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
subtest "don't repeat includes" => sub {
|
||||
my $s = $registry->serialize(
|
||||
'thing', [
|
||||
{ id => 1,
|
||||
subthings => [ { id => 2, x => 10 }, { id => 3, y => 20 } ] },
|
||||
{ id => 2,
|
||||
subthings => [ { id => 3, y => 20 }, { id => 2, x => 10 } ] }
|
||||
]
|
||||
);
|
||||
'thing',
|
||||
[
|
||||
{ id => 1,
|
||||
subthings => [ { id => 2, x => 10 }, { id => 3, y => 20 } ]
|
||||
},
|
||||
{ id => 2,
|
||||
subthings => [ { id => 3, y => 20 }, { id => 2, x => 10 } ]
|
||||
}
|
||||
]
|
||||
);
|
||||
|
||||
is $s->{ included }->@* + 0, 2;
|
||||
is $s->{included}->@* + 0, 2;
|
||||
};
|
||||
|
||||
done_testing;
|
||||
|
Loading…
Reference in New Issue
Block a user