const { existsSync, readFileSync } = require('node:fs'); const path = require('node:path'); const toolkitDataFiles = [ 'audio.json', 'changelog.json', 'credits.json', 'endings.json', 'factions.json', 'flags.json', 'images.json', 'legal.json', 'lore.json', 'map.json', 'opening.json', 'petitioners.json', 'references.json', 'resources.json', 'rulings.json', 'seed.json', 'story.json', ]; describe('toolkit data files', () => { it('keeps app content JSON consolidated under toolkit data', () => { for (const fileName of ['changelog.json', 'credits.json', 'legal.json']) { expect( existsSync(path.join(process.cwd(), 'src', 'data', 'toolkit', fileName)), ).toBe(true); expect(existsSync(path.join(process.cwd(), 'src', 'data', fileName))).toBe( false, ); } }); it('provides starter JSON content for every toolkit data resource', () => { for (const fileName of toolkitDataFiles) { const filePath = path.join( process.cwd(), 'src', 'data', 'toolkit', fileName, ); const content = JSON.parse(readFileSync(filePath, 'utf8')); if (Array.isArray(content)) { expect(content.length).toBeGreaterThan(0); } else { expect(Object.keys(content).length).toBeGreaterThan(0); } } }); });