File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ /* globals describe, it*/
2+ const config = require ( '../lib/index.js' )
3+ const fs = require ( 'fs' )
4+ const assert = require ( 'assert' )
5+ const path = require ( 'path' )
6+
7+ describe ( 'smoke tests' , ( ) => {
8+ it ( 'ensure all rules in lib/rules are included in index' , ( ) => {
9+ const exportedRules = new Set ( Object . keys ( config . rules ) )
10+ const files = new Set ( fs . readdirSync ( './lib/rules' ) . map ( f => path . basename ( f , path . extname ( f ) ) ) )
11+ assert . deepEqual ( files , exportedRules )
12+ } )
13+
14+ it ( 'exports every config in lib/config as .configs' , ( ) => {
15+ const exportedConfigs = new Set ( Object . keys ( config . configs ) )
16+ const files = new Set ( fs . readdirSync ( './lib/configs' ) . map ( f => path . basename ( f , path . extname ( f ) ) ) )
17+ assert . deepEqual ( files , exportedConfigs )
18+ } )
19+
20+ it ( 'exports valid rules in each config' , ( ) => {
21+ const exportedRules = new Set ( Object . keys ( config . rules ) )
22+ for ( const flavour in config . configs ) {
23+ for ( const rule in config . configs [ flavour ] . rules ) {
24+ if ( rule . startsWith ( 'github/' ) ) {
25+ assert ( exportedRules . has ( rule . replace ( / ^ g i t h u b \/ / , '' ) ) , `rule ${ rule } is not a valid rule` )
26+ }
27+ }
28+ }
29+ } )
30+ } )
You can’t perform that action at this time.
0 commit comments