mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-11-27 19:02:44 +01:00
Remove fs-extra sync updates
This commit is contained in:
1 parent
5cb461f9b5
commit
95cb5bad27
3 files changed
+2
-74
No files matched your search
@@ -34,14 +34,6 @@ describe('fsExtra copy fallback', () => {
|
||||
expect(fs.readFileSync(dest).equals(contents)).to.be.true
|
||||
})
|
||||
|
||||
it('copies in chunks when synchronous copyFile is denied', () => {
|
||||
sinon.stub(fs, 'copyFileSync').throws(Object.assign(new Error('copyfile denied'), { code: 'EPERM' }))
|
||||
|
||||
fsExtra.copySync(source, dest)
|
||||
|
||||
expect(fs.readFileSync(dest).equals(contents)).to.be.true
|
||||
})
|
||||
|
||||
it('moves across devices when asynchronous copyFile is denied', async () => {
|
||||
sinon.stub(fs, 'rename').callsFake((src, target, callback) => {
|
||||
callback(Object.assign(new Error('cross-device link'), { code: 'EXDEV' }))
|
||||
@@ -56,16 +48,6 @@ describe('fsExtra copy fallback', () => {
|
||||
expect(fs.readFileSync(dest).equals(contents)).to.be.true
|
||||
})
|
||||
|
||||
it('moves across devices when synchronous copyFile is denied', () => {
|
||||
sinon.stub(fs, 'renameSync').throws(Object.assign(new Error('cross-device link'), { code: 'EXDEV' }))
|
||||
sinon.stub(fs, 'copyFileSync').throws(Object.assign(new Error('copyfile denied'), { code: 'EPERM' }))
|
||||
|
||||
fsExtra.moveSync(source, dest)
|
||||
|
||||
expect(fs.existsSync(source)).to.be.false
|
||||
expect(fs.readFileSync(dest).equals(contents)).to.be.true
|
||||
})
|
||||
|
||||
it('moves over an existing file when asynchronous rename and copyFile are denied', async () => {
|
||||
fs.writeFileSync(dest, 'old database')
|
||||
sinon.stub(fs, 'rename').callsFake((src, target, callback) => {
|
||||
@@ -81,17 +63,6 @@ describe('fsExtra copy fallback', () => {
|
||||
expect(fs.readFileSync(dest).equals(contents)).to.be.true
|
||||
})
|
||||
|
||||
it('moves over an existing file when synchronous rename and copyFile are denied', () => {
|
||||
fs.writeFileSync(dest, 'old database')
|
||||
sinon.stub(fs, 'renameSync').throws(Object.assign(new Error('rename denied'), { code: 'EPERM' }))
|
||||
sinon.stub(fs, 'copyFileSync').throws(Object.assign(new Error('copyfile denied'), { code: 'EPERM' }))
|
||||
|
||||
fsExtra.moveSync(source, dest, { overwrite: true })
|
||||
|
||||
expect(fs.existsSync(source)).to.be.false
|
||||
expect(fs.readFileSync(dest).equals(contents)).to.be.true
|
||||
})
|
||||
|
||||
it('keeps the source when a move cannot copy it', async () => {
|
||||
sinon.stub(fs, 'rename').callsFake((src, target, callback) => {
|
||||
callback(Object.assign(new Error('rename denied'), { code: 'EPERM' }))
|
||||
|
||||
Reference in new issue
Block a user