33
src/data/sceneBackgrounds.test.ts
Normal file
33
src/data/sceneBackgrounds.test.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import { WorldType } from '../types';
|
||||
import { getDefaultCustomWorldSceneImage } from './customWorldVisuals';
|
||||
import { getScenePresetsByWorld } from './scenePresets';
|
||||
|
||||
function resolvePublicAssetPath(assetPath: string) {
|
||||
return path.resolve(process.cwd(), 'public', assetPath.replace(/^\/+/, ''));
|
||||
}
|
||||
|
||||
describe('scene background assets', () => {
|
||||
it('ships background files for every wuxia and xianxia scene preset', () => {
|
||||
const scenes = [
|
||||
...getScenePresetsByWorld(WorldType.WUXIA),
|
||||
...getScenePresetsByWorld(WorldType.XIANXIA),
|
||||
];
|
||||
|
||||
expect(scenes.length).toBeGreaterThan(0);
|
||||
|
||||
for (const scene of scenes) {
|
||||
expect(fs.existsSync(resolvePublicAssetPath(scene.imageSrc))).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it('returns existing default custom world backgrounds for both anchor worlds', () => {
|
||||
const wuxiaImage = getDefaultCustomWorldSceneImage('seed', 0, WorldType.WUXIA);
|
||||
const xianxiaImage = getDefaultCustomWorldSceneImage('seed', 0, WorldType.XIANXIA);
|
||||
|
||||
expect(fs.existsSync(resolvePublicAssetPath(wuxiaImage))).toBe(true);
|
||||
expect(fs.existsSync(resolvePublicAssetPath(xianxiaImage))).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user