Commit 36851591 authored by Antoine's avatar Antoine

Ensure ghost settings are removed from data when exporting. Fixes #728.

parent 78b9ce64
Pipeline #93640 passed with stages
in 4 minutes and 26 seconds
......@@ -122,6 +122,11 @@ export function cleanData(world) {
continue;
}
if (!s.id) {
log.warn(`Not exporting setting "${s.name}", it is a ghost setting.`);
continue;
}
delete s.id;
cleanMeta(s);
......
......@@ -6,6 +6,7 @@ import DefaultSettings from '../shared/default-settings';
describe('Ensure settings without default values are removed when exporting data', () => {
const UNKNOWN_SETTING = 'unknown-setting';
const KNOWN_SETTING = 'locale';
const GHOST_SETTING = 'weboob-version';
let world = {
settings: [
{
......@@ -17,6 +18,10 @@ describe('Ensure settings without default values are removed when exporting data
name: KNOWN_SETTING,
value: 'en',
id: '2'
},
{
name: GHOST_SETTING,
value: '1.3'
}
]
};
......@@ -29,4 +34,8 @@ describe('Ensure settings without default values are removed when exporting data
DefaultSettings.has(KNOWN_SETTING).should.equal(true);
all.settings.some(s => s.name === KNOWN_SETTING).should.equal(true);
});
it('The ghost setting should be removed from the list', () => {
DefaultSettings.has(GHOST_SETTING).should.equal(true);
all.settings.some(s => s.name === GHOST_SETTING).should.equal(false);
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment