mirror of https://github.com/TriliumNext/Notes
refactoring to allow unit tests of the whole search subsystem
parent
a06662f4ce
commit
cd48135394
@ -0,0 +1,7 @@
|
||||
const searchService = require('../src/services/search/search');
|
||||
|
||||
describe("Search", () => {
|
||||
it("fulltext parser without content", () => {
|
||||
// searchService.
|
||||
});
|
||||
});
|
||||
@ -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; }
|
||||
};
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
const optionService = require('./options');
|
||||
const sqlInit = require('./sql_init');
|
||||
const eventService = require('./events');
|
||||
const hoistedNote = require('./hoisted_note');
|
||||
|
||||
eventService.subscribe(eventService.ENTITY_CHANGED, async ({entityName, entity}) => {
|
||||
if (entityName === 'options' && entity.name === 'hoistedNoteId') {
|
||||
hoistedNote.setHoistedNoteId(entity.value);
|
||||
}
|
||||
});
|
||||
|
||||
sqlInit.dbReady.then(async () => {
|
||||
hoistedNote.setHoistedNoteId(await optionService.getOption('hoistedNoteId'));
|
||||
});
|
||||
Loading…
Reference in New Issue