2026-06-24 11:29:32 -05:00
|
|
|
const { existsSync, readFileSync } = require('node:fs');
|
2026-06-16 11:19:24 -05:00
|
|
|
const path = require('node:path');
|
|
|
|
|
|
2026-06-24 11:29:32 -05:00
|
|
|
const toolkitDataFiles = [
|
2026-06-16 11:19:24 -05:00
|
|
|
'audio.json',
|
2026-06-24 11:29:32 -05:00
|
|
|
'changelog.json',
|
2026-06-16 11:19:24 -05:00
|
|
|
'credits.json',
|
|
|
|
|
'endings.json',
|
|
|
|
|
'factions.json',
|
|
|
|
|
'flags.json',
|
2026-06-24 11:29:32 -05:00
|
|
|
'images.json',
|
|
|
|
|
'legal.json',
|
2026-06-16 11:19:24 -05:00
|
|
|
'lore.json',
|
|
|
|
|
'map.json',
|
|
|
|
|
'opening.json',
|
|
|
|
|
'petitioners.json',
|
|
|
|
|
'references.json',
|
|
|
|
|
'resources.json',
|
|
|
|
|
'rulings.json',
|
|
|
|
|
'seed.json',
|
|
|
|
|
'story.json',
|
|
|
|
|
];
|
|
|
|
|
|
2026-06-24 11:29:32 -05:00
|
|
|
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) {
|
2026-06-16 11:19:24 -05:00
|
|
|
const filePath = path.join(
|
|
|
|
|
process.cwd(),
|
|
|
|
|
'src',
|
|
|
|
|
'data',
|
|
|
|
|
'toolkit',
|
|
|
|
|
fileName,
|
|
|
|
|
);
|
|
|
|
|
const content = JSON.parse(readFileSync(filePath, 'utf8'));
|
|
|
|
|
|
2026-06-24 11:29:32 -05:00
|
|
|
if (Array.isArray(content)) {
|
|
|
|
|
expect(content.length).toBeGreaterThan(0);
|
|
|
|
|
} else {
|
|
|
|
|
expect(Object.keys(content).length).toBeGreaterThan(0);
|
|
|
|
|
}
|
2026-06-16 11:19:24 -05:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|