diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test-options-util.js | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/test/test-options-util.js b/test/test-options-util.js index a7dc41d1..00786dd6 100644 --- a/test/test-options-util.js +++ b/test/test-options-util.js @@ -63,6 +63,7 @@ function clone(value) { function createProfileOptionsTestData1() { return { + version: 14, general: { enable: true, enableClipboardPopups: false, @@ -495,7 +496,7 @@ function createOptionsUpdatedTestData1() { } ], profileCurrent: 0, - version: 4, + version: 5, global: { database: { prefixWildcardsSupported: false @@ -517,6 +518,32 @@ async function testUpdate(extDir) { assert.deepStrictEqual(optionsUpdated, optionsExpected); } +async function testDefault(extDir) { + const data = [ + (options) => options, + (options) => { + delete options.profiles[0].options.audio.autoPlay; + }, + (options) => { + options.profiles[0].options.audio.autoPlay = void 0; + } + ]; + + const vm = createVM(extDir); + const [OptionsUtil] = vm.get(['OptionsUtil']); + const optionsUtil = new OptionsUtil(); + await optionsUtil.prepare(); + + for (const modify of data) { + const options = optionsUtil.getDefault(); + + const optionsModified = clone(options); + modify(optionsModified); + + const optionsUpdated = await optionsUtil.update(clone(optionsModified)); + assert.deepStrictEqual(clone(optionsUpdated), clone(options)); + } +} async function testFieldTemplatesUpdate(extDir) { const vm = createVM(extDir); @@ -590,6 +617,7 @@ ${update4} async function main() { const extDir = path.join(__dirname, '..', 'ext'); await testUpdate(extDir); + await testDefault(extDir); await testFieldTemplatesUpdate(extDir); } |