diff --git a/test/settings.test.ts b/test/settings.test.ts index 05ae80fc1..8b159de1f 100644 --- a/test/settings.test.ts +++ b/test/settings.test.ts @@ -52,6 +52,37 @@ describe('Settings', () => { clearEnvironmentVariables(); }); + it('Ensures configuration.example.yaml is never out of sync with settings', () => { + let path = './data/configuration.example.yaml'; + + // allow running in single-test mode + if (!fs.existsSync('./data')) { + path = '../data/configuration.example.yaml'; + } + + const exampleYaml = read(path) as Record; + + // force keeping an eye on example yaml whenever CURRENT_VERSION changes + expect(exampleYaml).toStrictEqual({ + version: settings.CURRENT_VERSION, + homeassistant: { + enabled: false, + }, + frontend: { + enabled: true, + }, + mqtt: { + base_topic: 'zigbee2mqtt', + server: 'mqtt://localhost', + }, + advanced: { + network_key: 'GENERATE', + pan_id: 'GENERATE', + ext_pan_id: 'GENERATE', + }, + }); + }); + it('Should return default settings', () => { write(configurationFile, {}); const s = settings.get();