Skip to content

Commit

Permalink
[Sync-scan] Fix e2e timeout (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmyb authored Aug 18, 2023
1 parent 6a291a2 commit 9efafa7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
4 changes: 2 additions & 2 deletions apps/sync-scan/src/__tests__/e2e/database/test3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
22 changes: 14 additions & 8 deletions apps/sync-scan/src/__tests__/e2e/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ process.on('unhandledRejection', (reason: Error | any, promise: Promise<any>) =>
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
});

jest.setTimeout(20000);

beforeAll(async () => {
try {
cfg = await getConfig();
Expand Down Expand Up @@ -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 => {
Expand Down

0 comments on commit 9efafa7

Please sign in to comment.