fix(ignore): Ensure config example is never out of sync with settings (#25707)

This commit is contained in:
Nerivec authored and GitHub committed 2025-01-09 20:37:01 +01:00
1 parent 31bdf02a72
commit 23b709cee2
1 file changed
+31
+31
View File
@@ -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<string, unknown>;
// 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();