0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2025-01-20 22:52:46 -05:00

test(storage): replace the hacky test

This commit is contained in:
BuffayBu 2019-01-30 11:19:54 +08:00
parent 35f0b539d9
commit 933034f3c9

View file

@ -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()
})
})