Enable automatic speech for game replies
Build and publish frontend / publish (push) Failing after 3s
Build and publish frontend / publish (push) Failing after 3s
This commit is contained in:
@@ -176,6 +176,9 @@ test('settings survive reload and invalid storage falls back to accessible defau
|
||||
vm.runInNewContext(source, {window: global, globalThis: global, Promise, String, Math, Object});
|
||||
const values = new Map();
|
||||
const storage = {getItem: key => values.get(key) || null, setItem: (key, value) => values.set(key, value)};
|
||||
const defaults = GameVoice.loadSettings(storage, 'new-player');
|
||||
assert.equal(defaults.mode, 'game-voice');
|
||||
assert.equal(defaults.autoSpeak, true);
|
||||
const requested = {...GameVoice.DEFAULT_SETTINGS, mode: 'game-voice', autoSpeak: true, rate: 1.5, voiceName: 'Svensk'};
|
||||
assert.equal(GameVoice.saveSettings(storage, 'voice', requested), true);
|
||||
const loaded = GameVoice.loadSettings(storage, 'voice');
|
||||
@@ -184,6 +187,7 @@ test('settings survive reload and invalid storage falls back to accessible defau
|
||||
assert.equal(loaded.rate, 1.5);
|
||||
assert.equal(loaded.voiceName, 'Svensk');
|
||||
values.set('voice', '{trasig');
|
||||
assert.equal(GameVoice.loadSettings(storage, 'voice').mode, 'screen-reader');
|
||||
assert.equal(GameVoice.loadSettings(storage, 'voice').mode, 'game-voice');
|
||||
assert.equal(GameVoice.loadSettings(storage, 'voice').autoSpeak, true);
|
||||
assert.equal(GameVoice.saveSettings({setItem() { throw new Error('blocked'); }}, 'voice', requested), false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user