File tree Expand file tree Collapse file tree 1 file changed +15
-18
lines changed
Expand file tree Collapse file tree 1 file changed +15
-18
lines changed Original file line number Diff line number Diff line change @@ -1527,26 +1527,23 @@ describe('createSeededSvgPattern', () => {
15271527 'backbone' ,
15281528 ]
15291529
1530+ const expectedTagByPatternType : Record <
1531+ ReturnType < typeof createSeededSvgPattern > [ 'patternType' ] ,
1532+ string
1533+ > = {
1534+ diagonalLines : '<line' ,
1535+ verticalLines : '<line' ,
1536+ horizontalLines : '<line' ,
1537+ crosshatch : '<line' ,
1538+ dots : '<circle' ,
1539+ grid : '<line' ,
1540+ zigzag : '<path' ,
1541+ }
1542+
15301543 for ( const seed of seeds ) {
15311544 const result = createSeededSvgPattern ( seed )
1532-
1533- switch ( result . patternType ) {
1534- case 'dots' :
1535- expect ( result . contentMarkup ) . toContain ( '<circle' )
1536- break
1537-
1538- case 'zigzag' :
1539- expect ( result . contentMarkup ) . toContain ( '<path' )
1540- break
1541-
1542- case 'diagonalLines' :
1543- case 'verticalLines' :
1544- case 'horizontalLines' :
1545- case 'crosshatch' :
1546- case 'grid' :
1547- expect ( result . contentMarkup ) . toContain ( '<line' )
1548- break
1549- }
1545+ const expectedTag = expectedTagByPatternType [ result . patternType ]
1546+ expect ( result . contentMarkup ) . toContain ( expectedTag )
15501547 }
15511548 } )
15521549
You can’t perform that action at this time.
0 commit comments