test: use node v6 compatible fs api

This commit is contained in:
BuffayBu 2019-01-29 14:03:04 +08:00
parent 95686be47d
commit 35f0b539d9
1 changed files with 2 additions and 1 deletions

View File

@ -98,9 +98,10 @@ describe('StorageTest', () => {
test('should not touch if the package exists and has no uplinks', async (done) => {
const storage: IStorageHandler = await generateStorage();
const metadataSource = path.join(__dirname, '../partials/metadata')
const metadataPath = path.join(storagePath, 'npm_test/package.json')
fs.mkdirSync(path.join(storagePath, 'npm_test'))
fs.copyFileSync(path.join(__dirname, '../partials/metadata'), metadataPath)
fs.writeFileSync(metadataPath, fs.readFileSync(metadataSource));
const metadata = JSON.parse(fs.readFileSync(metadataPath).toString())
const prevStat = fs.statSync(metadataPath)
storage._syncUplinksMetadata('npm_test', metadata, {}, (err) => {