File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import * as fs from 'fs'
2+ import * as path from 'path'
3+ import mapIndex from '@/public/maps/map-index.json'
4+
5+ describe ( 'Interactive Map Integrity' , ( ) => {
6+ it ( 'should have markdown files for all entries in map-index.json' , ( ) => {
7+ const missingFiles : string [ ] = [ ]
8+ const documentsDir = path . join ( __dirname , '../../..' , 'documents' )
9+
10+ Object . entries ( mapIndex ) . forEach ( ( [ number , info ] ) => {
11+ const { category, slug } = info
12+ const markdownPath = path . join ( documentsDir , category , `${ slug } .md` )
13+
14+ if ( ! fs . existsSync ( markdownPath ) ) {
15+ missingFiles . push ( `${ category } /${ slug } (map node #${ number } )` )
16+ }
17+ } )
18+
19+ if ( missingFiles . length > 0 ) {
20+ throw new Error (
21+ `Map nodes reference missing markdown files:\n${ missingFiles . map ( f => ` - ${ f } ` ) . join ( '\n' ) } `
22+ )
23+ }
24+ } )
25+ } )
You can’t perform that action at this time.
0 commit comments