1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Mobile: Resolves #10245: Allow marking items as "ignored" in sync status (#10261)

This commit is contained in:
Henry Heino
2024-04-08 04:35:57 -07:00
committed by GitHub
parent b3f4414026
commit 03c3feef16
12 changed files with 290 additions and 44 deletions

View File

@ -0,0 +1,35 @@
import SyncTargetRegistry from '../../SyncTargetRegistry';
import { createNTestNotes, setupDatabaseAndSynchronizer, switchClient } from '../../testing/test-utils';
import BaseItem from '../BaseItem';
import Folder from '../Folder';
import Setting from '../Setting';
import settingValidations from './settingValidations';
describe('settingValidations', () => {
beforeEach(async () => {
await setupDatabaseAndSynchronizer(1);
await switchClient(1);
});
test('sync disabled items should prevent switching sync targets unless ignored', async () => {
const folder = await Folder.save({ title: 'Test' });
const noteCount = 5;
const testNotes = await createNTestNotes(noteCount, folder);
const syncTargetId = SyncTargetRegistry.nameToId('memory');
Setting.setValue('sync.target', syncTargetId);
for (const testNote of testNotes) {
await BaseItem.saveSyncDisabled(syncTargetId, testNote, 'Disabled reason');
}
const newSyncTargetId = SyncTargetRegistry.nameToId('dropbox');
// Validation should fail with some error message.
expect(await settingValidations(['sync.target'], { 'sync.target': newSyncTargetId })).not.toBe('');
// Should pass after dismissing all warnings
for (const testNote of testNotes) {
await BaseItem.ignoreItemSyncWarning(syncTargetId, testNote);
}
expect(await settingValidations(['sync.target'], { 'sync.target': newSyncTargetId })).toBe('');
});
});