Files
blb-throne-of-the-bone-king/__tests__/gameSettings.test.ts
T

52 lines
1.4 KiB
TypeScript
Raw Normal View History

2026-06-10 15:01:09 -05:00
import {
clampVolume,
defaultAutosaveEnabled,
defaultGameResolutionId,
defaultVolumeSettings,
formatResolutionLabel,
gameResolutionOptions,
} from '../src/settings/gameSettings';
describe('game settings definitions', () => {
it('uses landscape phone dimensions for the default enforced resolution', () => {
expect(defaultGameResolutionId).toBe('iphoneDefault');
expect(formatResolutionLabel(defaultGameResolutionId)).toBe(
'Phone Default (844 x 390)',
);
const boundedOptions = gameResolutionOptions.filter(
option => !('unbounded' in option),
);
expect(boundedOptions.map(option => option.width)).toEqual([
812,
844,
915,
932,
]);
expect(boundedOptions.every(option => option.width > option.height)).toBe(true);
});
it('defines a browser resolution that fills available space', () => {
expect(formatResolutionLabel('browser')).toBe(
'Browser (Fill available space)',
);
});
it('clamps volumes between 0 and 100', () => {
expect(clampVolume(-5)).toBe(0);
expect(clampVolume(55)).toBe(55);
expect(clampVolume(105)).toBe(100);
});
it('defines autosave and every default volume setting', () => {
expect(defaultAutosaveEnabled).toBe(true);
expect(defaultVolumeSettings).toEqual({
ambience: 70,
master: 80,
music: 70,
2026-06-12 08:19:40 -05:00
sfx: 80,
2026-06-10 15:01:09 -05:00
speech: 80,
});
});
});