File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ const fs = require ( 'fs' ) ;
2+ const path = require ( 'path' ) ;
3+
4+ describe ( 'piconss SVG format validation' , ( ) => {
5+ const themes = [ 'dark' , 'light' , 'default' ] ;
6+ const iconDir = path . join ( __dirname , '../icons' ) ;
7+
8+ const isSvgFormat = ( fileContent ) => {
9+ return fileContent . startsWith ( '<svg' ) && fileContent . endsWith ( '</svg>' ) ;
10+ } ;
11+
12+ themes . forEach ( ( theme ) => {
13+ const themeDir = path . join ( iconDir , theme ) ;
14+ test ( `should validate all SVG icons in ${ theme } theme` , ( ) => {
15+ const icons = fs
16+ . readdirSync ( themeDir )
17+ . filter ( ( file ) => file . endsWith ( '.svg' ) ) ;
18+ icons . forEach ( ( icon ) => {
19+ console . log ( `Checking icon: ${ icon } ` ) ;
20+ const iconPath = path . join ( themeDir , icon ) ;
21+ const content = fs . readFileSync ( iconPath , 'utf-8' ) ;
22+ expect ( isSvgFormat ( content ) ) . toBe ( true ) ;
23+ } ) ;
24+ } ) ;
25+ } ) ;
26+ } ) ;
You can’t perform that action at this time.
0 commit comments