From 9efafa79f6ff290b445286bf73b407a7e6a36813 Mon Sep 17 00:00:00 2001 From: jrmyb <9062561+jrmyb@users.noreply.github.com> Date: Fri, 18 Aug 2023 09:54:23 +0200 Subject: [PATCH] [Sync-scan] Fix e2e timeout (#299) --- .../src/__tests__/e2e/database/test3.ts | 4 ++-- .../sync-scan/src/__tests__/e2e/index.test.ts | 22 ++++++++++++------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/apps/sync-scan/src/__tests__/e2e/database/test3.ts b/apps/sync-scan/src/__tests__/e2e/database/test3.ts index 2c98b69d5..2efda7953 100644 --- a/apps/sync-scan/src/__tests__/e2e/database/test3.ts +++ b/apps/sync-scan/src/__tests__/e2e/database/test3.ts @@ -12,10 +12,10 @@ export default (inodes: {[ino: string]: any}) => setInodes(inodes, database); const setInodes = (inodes: {[ino: string]: any}, elements: FullTreeContent): FullTreeContent => { for (const [i, e] of elements.entries()) { - e.record.inode = Number(Object.keys(inodes)[i]); + e.record.inode = Number(inodes[i].ino); if (e.record.library === DB_SETTINGS.directoriesLibraryId && e.children.length) { - e.children = setInodes(inodes[Object.keys(inodes)[i]], e.children); + e.children = setInodes(inodes[i].children, e.children); } } diff --git a/apps/sync-scan/src/__tests__/e2e/index.test.ts b/apps/sync-scan/src/__tests__/e2e/index.test.ts index ae4767468..26579e6a4 100644 --- a/apps/sync-scan/src/__tests__/e2e/index.test.ts +++ b/apps/sync-scan/src/__tests__/e2e/index.test.ts @@ -25,6 +25,8 @@ process.on('unhandledRejection', (reason: Error | any, promise: Promise) => console.error('Unhandled Rejection at:', promise, 'reason:', reason); }); +jest.setTimeout(20000); + beforeAll(async () => { try { cfg = await getConfig(); @@ -78,15 +80,19 @@ describe('e2e tests', () => { expect(fs.existsSync(`${cfg.filesystem.absolutePath}/dir/sfile`)).toEqual(true); expect(fs.existsSync(`${cfg.filesystem.absolutePath}/dir/sdir/ssfile`)).toEqual(true); - inodes = { - [fs.statSync(`${cfg.filesystem.absolutePath}/dir`).ino]: { - [fs.statSync(`${cfg.filesystem.absolutePath}/dir/sdir`).ino]: { - [fs.statSync(`${cfg.filesystem.absolutePath}/dir/sdir/ssfile`).ino]: {} - }, - [fs.statSync(`${cfg.filesystem.absolutePath}/dir/sfile`).ino]: {} + inodes = [ + { + ino: fs.statSync(`${cfg.filesystem.absolutePath}/dir`).ino, + children: [ + { + ino: fs.statSync(`${cfg.filesystem.absolutePath}/dir/sdir`).ino, + children: [{ino: fs.statSync(`${cfg.filesystem.absolutePath}/dir/sdir/ssfile`).ino}] + }, + {ino: fs.statSync(`${cfg.filesystem.absolutePath}/dir/sfile`).ino} + ] }, - [fs.statSync(`${cfg.filesystem.absolutePath}/file`).ino]: {} - }; + {ino: fs.statSync(`${cfg.filesystem.absolutePath}/file`).ino} + ]; }); test('2 - initialization/creation events', async done => {