From 933034f3c92542db77de5b5cfceaf156cd03409e Mon Sep 17 00:00:00 2001 From: BuffayBu Date: Wed, 30 Jan 2019 11:19:54 +0800 Subject: [PATCH] test(storage): replace the hacky test --- test/unit/api/store.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/unit/api/store.spec.js b/test/unit/api/store.spec.js index 0eed92228..ee93fc40b 100644 --- a/test/unit/api/store.spec.js +++ b/test/unit/api/store.spec.js @@ -103,11 +103,11 @@ describe('StorageTest', () => { fs.mkdirSync(path.join(storagePath, 'npm_test')) fs.writeFileSync(metadataPath, fs.readFileSync(metadataSource)); const metadata = JSON.parse(fs.readFileSync(metadataPath).toString()) - const prevStat = fs.statSync(metadataPath) + // $FlowFixMe + storage.localStorage.updateVersions = jest.fn(storage.localStorage.updateVersions) storage._syncUplinksMetadata('npm_test', metadata, {}, (err) => { - expect(err).toBeFalsy() - const nextStat = fs.statSync(metadataPath) - expect(nextStat).toEqual(prevStat) + expect(err).toBeNull() + expect(storage.localStorage.updateVersions).not.toHaveBeenCalled() done() }) })