formatting

This commit is contained in:
Yanick Champoux 2023-11-13 09:57:37 -05:00
parent 250bd940da
commit 8e5df8fbf0

View File

@ -14,7 +14,9 @@ subtest basic => sub {
my $s = $registry->serialize( my $s = $registry->serialize(
'thing', 'thing',
{ id => 1, { id => 1,
subthings => [ { id => 2, x => 10 }, { id => 3 } ] } ); subthings => [ { id => 2, x => 10 }, { id => 3 } ]
}
);
ok not $s->{data}{attributes}; ok not $s->{data}{attributes};
@ -26,21 +28,25 @@ subtest basic => sub {
{ subthings => { data => [ { id => 2 }, { id => 3 } ] } } { subthings => { data => [ { id => 2 }, { id => 3 } ] } }
}, },
included => included =>
[ { type => 'subthing', id => 2, attributes => { x => 10 } }, ] }; [ { type => 'subthing', id => 2, attributes => { x => 10 } }, ]
};
}; };
subtest "don't repeat includes" => sub { subtest "don't repeat includes" => sub {
my $s = $registry->serialize( my $s = $registry->serialize(
'thing', [ 'thing',
{ id => 1, [
subthings => [ { id => 2, x => 10 }, { id => 3, y => 20 } ] }, { id => 1,
{ id => 2, subthings => [ { id => 2, x => 10 }, { id => 3, y => 20 } ]
subthings => [ { id => 3, y => 20 }, { id => 2, x => 10 } ] } },
] { id => 2,
); subthings => [ { id => 3, y => 20 }, { id => 2, x => 10 } ]
}
]
);
is $s->{ included }->@* + 0, 2; is $s->{included}->@* + 0, 2;
}; };
done_testing; done_testing;