formatting

releases
Yanick Champoux 2023-11-13 09:57:37 -05:00
parent 250bd940da
commit 8e5df8fbf0
1 changed files with 16 additions and 10 deletions

View File

@ -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;