@@ -625,53 +625,94 @@ describe('repairConfig', () => {
625625 } )
626626 } )
627627
628- const pageSizes = [ ( 'A5' , 'A4' , 'A3' ) ]
629- pageSizes . forEach ( ( pageSize ) => {
630- test ( `allows pageSize ${ pageSize } ` , async ( ) => {
631- // given
632- const config = {
633- camp : '/camps/1a2b3c4d' ,
634- contents : [
635- {
636- type : 'Picasso' ,
637- options : {
638- periods : [ '/periods/1a2b3c4d' ] ,
639- orientation : 'L' ,
640- filter : defaultFilter ,
641- } ,
628+ test . each ( [ 'A5' , 'A4' , 'A3' ] ) ( 'allows pageSize %p' , async ( pageSize ) => {
629+ // given
630+ const config = {
631+ camp : '/camps/1a2b3c4d' ,
632+ contents : [
633+ {
634+ type : 'Picasso' ,
635+ options : {
636+ periods : [ '/periods/1a2b3c4d' ] ,
637+ orientation : 'L' ,
638+ filter : defaultFilter ,
642639 } ,
643- ] ,
644- documentName : 'test camp' ,
645- options : {
646- pageNumbers : false ,
647- pageSize,
648640 } ,
649- language : 'de-CH-scout' ,
650- }
641+ ] ,
642+ documentName : 'test camp' ,
643+ options : {
644+ pageNumbers : false ,
645+ pageSize,
646+ } ,
647+ language : 'de-CH-scout' ,
648+ }
651649
652- // when
653- const result = repairConfig ( config , ...args )
650+ // when
651+ const result = repairConfig ( config , ...args )
654652
655- // then
656- expect ( result ) . toEqual ( {
657- camp : '/camps/1a2b3c4d' ,
658- contents : [
659- {
660- type : 'Picasso' ,
661- options : {
662- periods : [ '/periods/1a2b3c4d' ] ,
663- orientation : 'L' ,
664- filter : defaultFilter ,
665- } ,
653+ // then
654+ expect ( result ) . toEqual ( {
655+ camp : '/camps/1a2b3c4d' ,
656+ contents : [
657+ {
658+ type : 'Picasso' ,
659+ options : {
660+ periods : [ '/periods/1a2b3c4d' ] ,
661+ orientation : 'L' ,
662+ filter : defaultFilter ,
666663 } ,
667- ] ,
668- documentName : 'test camp' ,
669- options : {
670- pageNumbers : false ,
671- pageSize,
672664 } ,
673- language : 'de-CH-scout' ,
674- } )
665+ ] ,
666+ documentName : 'test camp' ,
667+ options : {
668+ pageNumbers : false ,
669+ pageSize,
670+ } ,
671+ language : 'de-CH-scout' ,
672+ } )
673+ } )
674+
675+ test ( 'repairs invalid pageSize' , async ( ) => {
676+ // given
677+ const config = {
678+ camp : '/camps/1a2b3c4d' ,
679+ contents : [
680+ {
681+ type : 'Picasso' ,
682+ options : {
683+ periods : [ '/periods/1a2b3c4d' ] ,
684+ orientation : 'L' ,
685+ filter : defaultFilter ,
686+ } ,
687+ } ,
688+ ] ,
689+ documentName : 'test camp' ,
690+ options : {
691+ pageNumbers : false ,
692+ pageSize : 'tiny' ,
693+ } ,
694+ language : 'de-CH-scout' ,
695+ }
696+
697+ // when
698+ const result = repairConfig ( config , ...args )
699+
700+ // then
701+ expect ( result ) . toEqual ( {
702+ camp : '/camps/1a2b3c4d' ,
703+ contents : [
704+ {
705+ type : 'Picasso' ,
706+ options : {
707+ periods : [ '/periods/1a2b3c4d' ] ,
708+ orientation : 'L' ,
709+ filter : defaultFilter ,
710+ } ,
711+ } ,
712+ ] ,
713+ documentName : 'test camp' ,
714+ options : defaultOptions ,
715+ language : 'de-CH-scout' ,
675716 } )
676717 } )
677718
0 commit comments