Skip to content

Commit

Permalink
fix(ignore): Ensure config example is never out of sync with settings (
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerivec authored Jan 9, 2025
1 parent 31bdf02 commit 23b709c
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 23b709c

Please sign in to comment.