|
@@ -81,7 +81,7 @@ describe "FSPersistorManagerTests", ->
|
|
|
it "should use correct file location", (done) ->
|
|
it "should use correct file location", (done) ->
|
|
|
@Fs.createReadStream.returns({on: ->})
|
|
@Fs.createReadStream.returns({on: ->})
|
|
|
@FSPersistorManager.getFileStream @location, @name1, @opts, (err,res) =>
|
|
@FSPersistorManager.getFileStream @location, @name1, @opts, (err,res) =>
|
|
|
- @Fs.createReadStream.calledWith("#{@location}/#{@name1Filtered}").should.equal.true
|
|
|
|
|
|
|
+ @Fs.createReadStream.calledWith("#{@location}/#{@name1Filtered}").should.equal true
|
|
|
done()
|
|
done()
|
|
|
|
|
|
|
|
describe "with start and end options", ->
|
|
describe "with start and end options", ->
|
|
@@ -144,17 +144,17 @@ describe "FSPersistorManagerTests", ->
|
|
|
|
|
|
|
|
it "Should open the source for reading", (done) ->
|
|
it "Should open the source for reading", (done) ->
|
|
|
@FSPersistorManager.copyFile @location, @name1, @name2, ->
|
|
@FSPersistorManager.copyFile @location, @name1, @name2, ->
|
|
|
- @Fs.createReadStream.calledWith("#{@location}/#{@name1}").should.equal.true
|
|
|
|
|
|
|
+ @Fs.createReadStream.calledWith("#{@location}/#{@name1Filtered}").should.equal true
|
|
|
done()
|
|
done()
|
|
|
|
|
|
|
|
it "Should open the target for writing", (done) ->
|
|
it "Should open the target for writing", (done) ->
|
|
|
@FSPersistorManager.copyFile @location, @name1, @name2, ->
|
|
@FSPersistorManager.copyFile @location, @name1, @name2, ->
|
|
|
- @Fs.createWriteStream.calledWith("#{@location}/#{@name2}").should.equal.true
|
|
|
|
|
|
|
+ @Fs.createWriteStream.calledWith("#{@location}/#{@name2}").should.equal true
|
|
|
done()
|
|
done()
|
|
|
|
|
|
|
|
it "Should pipe the source to the target", (done) ->
|
|
it "Should pipe the source to the target", (done) ->
|
|
|
@FSPersistorManager.copyFile @location, @name1, @name2, ->
|
|
@FSPersistorManager.copyFile @location, @name1, @name2, ->
|
|
|
- @ReadStream.pipe.calledWith(@WriteStream).should.equal.true
|
|
|
|
|
|
|
+ @ReadStream.pipe.calledWith(@WriteStream).should.equal true
|
|
|
done()
|
|
done()
|
|
|
|
|
|
|
|
describe "deleteFile", ->
|
|
describe "deleteFile", ->
|
|
@@ -163,7 +163,7 @@ describe "FSPersistorManagerTests", ->
|
|
|
|
|
|
|
|
it "Should call unlink with correct options", (done) ->
|
|
it "Should call unlink with correct options", (done) ->
|
|
|
@FSPersistorManager.deleteFile @location, @name1, (err) =>
|
|
@FSPersistorManager.deleteFile @location, @name1, (err) =>
|
|
|
- @Fs.unlink.calledWith("#{@location}/#{@name1}").should.equal.true
|
|
|
|
|
|
|
+ @Fs.unlink.calledWith("#{@location}/#{@name1Filtered}").should.equal true
|
|
|
done()
|
|
done()
|
|
|
|
|
|
|
|
it "Should propogate the error", (done) ->
|
|
it "Should propogate the error", (done) ->
|
|
@@ -178,7 +178,7 @@ describe "FSPersistorManagerTests", ->
|
|
|
|
|
|
|
|
it "Should call rmdir(rimraf) with correct options", (done) ->
|
|
it "Should call rmdir(rimraf) with correct options", (done) ->
|
|
|
@FSPersistorManager.deleteDirectory @location, @name1, (err) =>
|
|
@FSPersistorManager.deleteDirectory @location, @name1, (err) =>
|
|
|
- @Rimraf.calledWith("#{@location}/#{@name1}").should.equal.true
|
|
|
|
|
|
|
+ @Rimraf.calledWith("#{@location}/#{@name1Filtered}").should.equal true
|
|
|
done()
|
|
done()
|
|
|
|
|
|
|
|
it "Should propogate the error", (done) ->
|
|
it "Should propogate the error", (done) ->
|
|
@@ -192,7 +192,7 @@ describe "FSPersistorManagerTests", ->
|
|
|
|
|
|
|
|
it "Should call exists with correct options", (done) ->
|
|
it "Should call exists with correct options", (done) ->
|
|
|
@FSPersistorManager.checkIfFileExists @location, @name1, (exists) =>
|
|
@FSPersistorManager.checkIfFileExists @location, @name1, (exists) =>
|
|
|
- @Fs.exists.calledWith("#{@location}/#{@name1}").should.equal.true
|
|
|
|
|
|
|
+ @Fs.exists.calledWith("#{@location}/#{@name1Filtered}").should.equal true
|
|
|
done()
|
|
done()
|
|
|
|
|
|
|
|
# fs.exists simply returns false on any error, so...
|
|
# fs.exists simply returns false on any error, so...
|
|
@@ -226,4 +226,4 @@ describe "FSPersistorManagerTests", ->
|
|
|
@Fs.fstatSync.returns({size : 1024})
|
|
@Fs.fstatSync.returns({size : 1024})
|
|
|
@FSPersistorManager.directorySize @location, @name1, (err, totalsize) =>
|
|
@FSPersistorManager.directorySize @location, @name1, (err, totalsize) =>
|
|
|
expect(totalsize).to.equal 2048
|
|
expect(totalsize).to.equal 2048
|
|
|
- done()
|
|
|
|
|
|
|
+ done()
|