2020-04-08 01:06:29 +02:00
|
|
|
/* eslint-disable no-unused-vars */
|
2021-05-21 15:17:21 +02:00
|
|
|
const { setupDatabaseAndSynchronizer, switchClient, createNTestFolders, createNTestNotes, createNTestTags, TestApp } = require('@joplin/lib/testing/test-utils.js');
|
2020-11-07 17:59:37 +02:00
|
|
|
const Setting = require('@joplin/lib/models/Setting').default;
|
2021-01-22 19:41:11 +02:00
|
|
|
const Folder = require('@joplin/lib/models/Folder').default;
|
|
|
|
const Note = require('@joplin/lib/models/Note').default;
|
|
|
|
const Tag = require('@joplin/lib/models/Tag').default;
|
2020-11-07 17:59:37 +02:00
|
|
|
const time = require('@joplin/lib/time').default;
|
2020-04-08 01:06:29 +02:00
|
|
|
|
|
|
|
let testApp = null;
|
|
|
|
|
2023-02-20 17:02:29 +02:00
|
|
|
describe('integration_NoteList', () => {
|
2020-04-08 01:06:29 +02:00
|
|
|
|
2022-11-15 12:23:50 +02:00
|
|
|
beforeEach(async () => {
|
2020-04-08 01:06:29 +02:00
|
|
|
testApp = new TestApp();
|
|
|
|
await testApp.start(['--no-welcome']);
|
|
|
|
});
|
|
|
|
|
2022-11-15 12:23:50 +02:00
|
|
|
afterEach(async () => {
|
2020-04-08 01:06:29 +02:00
|
|
|
if (testApp !== null) await testApp.destroy();
|
|
|
|
testApp = null;
|
|
|
|
});
|
|
|
|
|
|
|
|
// Reference: https://github.com/laurent22/joplin/issues/2709
|
2020-12-01 20:05:24 +02:00
|
|
|
it('should leave a conflict note in the conflict folder when it modified', (async () => {
|
2020-04-08 01:06:29 +02:00
|
|
|
const folder = await Folder.save({ title: 'test' });
|
|
|
|
const note = await Note.save({ title: 'note 1', parent_id: folder.id, is_conflict: 1 });
|
|
|
|
await testApp.wait();
|
|
|
|
|
|
|
|
testApp.dispatch({ type: 'FOLDER_SELECT', id: Folder.conflictFolderId() });
|
|
|
|
await testApp.wait();
|
|
|
|
|
|
|
|
testApp.dispatch({ type: 'NOTE_SELECT', id: note.id });
|
|
|
|
await testApp.wait();
|
|
|
|
|
|
|
|
// Check that the conflict folder is selected and that the conflict note is inside
|
|
|
|
let state = testApp.store().getState();
|
|
|
|
expect(state.selectedFolderId).toBe(Folder.conflictFolderId());
|
|
|
|
expect(state.selectedNoteIds[0]).toBe(note.id);
|
|
|
|
|
|
|
|
await Note.save({ id: note.id, title: 'note 1 mod', is_conflict: 1 });
|
|
|
|
await testApp.wait();
|
|
|
|
|
|
|
|
// Check that the conflict folder is still selected with the note still inside
|
|
|
|
state = testApp.store().getState();
|
|
|
|
expect(state.selectedFolderId).toBe(Folder.conflictFolderId());
|
|
|
|
expect(state.selectedNoteIds[0]).toBe(note.id);
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|