refactoring to allow unit tests of the whole search subsystem

This commit is contained in:
zadam
2020-05-21 14:05:56 +02:00
parent a06662f4ce
commit cd48135394
9 changed files with 42 additions and 32 deletions

View File

@@ -1,19 +1,6 @@
const optionService = require('./options');
const sqlInit = require('./sql_init');
const eventService = require('./events');
let hoistedNoteId = 'root';
eventService.subscribe(eventService.ENTITY_CHANGED, async ({entityName, entity}) => {
if (entityName === 'options' && entity.name === 'hoistedNoteId') {
hoistedNoteId = entity.value;
}
});
sqlInit.dbReady.then(async () => {
hoistedNoteId = await optionService.getOption('hoistedNoteId');
});
module.exports = {
getHoistedNoteId: () => hoistedNoteId
};
getHoistedNoteId: () => hoistedNoteId,
setHoistedNoteId(noteId) { hoistedNoteId = noteId; }
};