1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Chore: Silence expected warning while running tests in lib/ (#12450)

This commit is contained in:
Henry Heino
2025-06-10 16:13:13 -07:00
committed by GitHub
parent 7a611ac5c5
commit 303ccce7d2
2 changed files with 23 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
import { ErrorCode } from '../errors';
import { FolderEntity } from '../services/database/types';
import { createNTestNotes, setupDatabaseAndSynchronizer, sleep, switchClient, checkThrowAsync, createFolderTree, simulateReadOnlyShareEnv, expectThrow } from '../testing/test-utils';
import { createNTestNotes, setupDatabaseAndSynchronizer, sleep, switchClient, checkThrowAsync, createFolderTree, simulateReadOnlyShareEnv, expectThrow, withWarningSilenced } from '../testing/test-utils';
import Folder from './Folder';
import Note from './Note';
@@ -174,8 +174,10 @@ describe('models/Folder', () => {
await Folder.save({ id: f1.id, parent_id: f3.id });
const folders = await Folder.all();
// Should not loop indefinitely:
await Folder.addNoteCounts(folders);
// Should not loop indefinitely, okay to warn:
await withWarningSilenced(/has itself as a parent/, async () => {
await Folder.addNoteCounts(folders);
});
// Note count may be incorrect
expect(folders.find(folder => folder.id === f1.id)).toHaveProperty('note_count');
});