Files

52 lines
1.4 KiB
TypeScript

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,
sfx: 80,
speech: 80,
});
});
});