blib/lib/JMAP/Validation/Generators/SetError.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 30 SCAR 24.8
CC
3
Cov
0%
generate
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 12.0
1 package JMAP::Validation::Generators::SetError;
2  
3 use strict;
4 use warnings;
5  
6 use JMAP::Validation::Generators::String;
7 use JSON::Typist;
8  
9 my %types = (
10 invalidArguments => {
11 description => JMAP::Validation::Generators::String->generate(),
12 },
13 invalidProperties => {
14 properties => [],
15 description => JMAP::Validation::Generators::String->generate(),
16 },
17 (
18 map { $_ => undef }
19 qw{
20 accountReadOnly
21 fromAccountNoMail
22 fromAccountNotFound
23 invalidMailboxes
24 maxQuotaReached
25 notFound
26 stateMismatch
27 toAccountNoMail
28 toAccountNotFound
29 }
30 ),
31 );
32  
33 sub generate {
34 my (@types) = @_;
35  
36 my @SetErrors;
37  
38 foreach my $type (@types ? @types : (keys %types)) {
39 push @SetErrors, {
40 type => JSON::Typist::String->new($type),
41 ($types{$type} ? (%{$types{$type}}) : ()),
42 };
43 }
44  
45 return \@SetErrors;
46 }
47  
48 1;