<commit_before>use strict;
use warnings;
use Test::More;

use Module::Runtime qw( use_module );

my $itemc = use_module('Business::CyberSource::RequestPart::Item');

{
	package Test;
		use Moose;
		with qw(
			MooseX::RemoteHelper::CompositeSerialization
			Business::CyberSource::Request::Role::Items
		);
		__PACKAGE__->meta->make_immutable;
}

my $item0
	= new_ok( $itemc => [{
		unit_price => 2.12,
	}]);

my $item1
	= new_ok( $itemc => [{
		unit_price => 1.00,
		quantity   => 2,
	}]);

my $test
	= new_ok( Test => [{
		items => [ $item0, $item1 ],
	}]);

can_ok $test, 'serialize';

my %expected_serialized = (
	item => [
		{
			id        => 0,
			unitPrice => 2.12,
			quantity  => 1,
		},
		{
			id        => 1,
			unitPrice => 1.00,
			quantity  => 2,
		},
	],
);

is_deeply( $test->serialize, \%expected_serialized, 'serialize' );

done_testing;
<commit_msg>modify test to work without role<commit_after>use strict;
use warnings;
use Test::More;

use Module::Runtime qw( use_module );

my $itemc = use_module('Business::CyberSource::RequestPart::Item');

{
	package Test;
		use Moose;
		extends 'Business::CyberSource::Request';

		has '+purchase_totals' => ( required => 0 );
		has '+reference_code'  => ( required => 0 );

		__PACKAGE__->meta->make_immutable;
}

my $item0
	= new_ok( $itemc => [{
		unit_price => 2.12,
	}]);

my $item1
	= new_ok( $itemc => [{
		unit_price => 1.00,
		quantity   => 2,
	}]);

my $test
	= new_ok( Test => [{
		items => [ $item0, $item1 ],
	}]);

can_ok $test, 'serialize';

my %expected_serialized = (
	item => [
		{
			id        => 0,
			unitPrice => 2.12,
			quantity  => 1,
		},
		{
			id        => 1,
			unitPrice => 1.00,
			quantity  => 2,
		},
	],
);

is_deeply( $test->serialize, \%expected_serialized, 'serialize' );

done_testing;

{'fraction_non_alphanumeric': 0.18385650224215247, 'fraction_numerical': 0.02466367713004484, 'mean_word_length': 3.2908653846153846, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3912673', 'n_tokens_mistral': 800, 'n_tokens_neox': 701, 'n_words': 143}