From bcb66b2ccf4804468f8d9f8c7c36ae0466631a93 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Wed, 22 Dec 2021 19:08:53 +0100 Subject: [PATCH] fix(core): update --- test/test.ts | 4 ++++ ts/smartfile.fs.ts | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/test.ts b/test/test.ts index f780ad3..5d127a9 100644 --- a/test/test.ts +++ b/test/test.ts @@ -213,4 +213,8 @@ tap.test('should create, store and retrieve valid smartfiles', async () => { expect(retrievedString).to.equal(fileString); }); +tap.test('should wait for file to be ready', async () => { + await smartfile.fs.waitForFileToBeReady('./test/testassets/mytest.json') +}) + tap.start(); diff --git a/ts/smartfile.fs.ts b/ts/smartfile.fs.ts index 8989fda..602fb57 100644 --- a/ts/smartfile.fs.ts +++ b/ts/smartfile.fs.ts @@ -388,7 +388,7 @@ export const waitForFileToBeReady = async (filePathArg: string): Promise = limitedArray.addOne(stats.size); if ( limitedArray.array.length < 3 || - !(limitedArray.array[0] === limitedArray[1] && limitedArray.array[1] === limitedArray[2]) + !(limitedArray.array[0] === limitedArray.array[1] && limitedArray.array[1] === limitedArray.array[2]) ) { await plugins.smartdelay.delayFor(5000); } else {