mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Test the FileHandler layer.
This commit is contained in:
parent
64f70eddbd
commit
ed980a21e1
1 changed files with 14 additions and 4 deletions
|
@ -93,6 +93,13 @@ describe "FileHandler", ->
|
|||
@handler._getConvertedFile.called.should.equal false
|
||||
done()
|
||||
|
||||
it "should pass options to _getStandardFile", (done) ->
|
||||
options = {start: 0, end: 8}
|
||||
@handler.getFile @bucket, @key, options, =>
|
||||
expect(@handler._getStandardFile.lastCall.args[2].start).to.equal 0
|
||||
expect(@handler._getStandardFile.lastCall.args[2].end).to.equal 8
|
||||
done()
|
||||
|
||||
it "should call _getConvertedFile if a format is defined", (done)->
|
||||
@handler.getFile @bucket, @key, format:"png", =>
|
||||
@handler._getStandardFile.called.should.equal false
|
||||
|
@ -117,6 +124,13 @@ describe "FileHandler", ->
|
|||
stream.should.equal @fileStream
|
||||
done()
|
||||
|
||||
it "should pass options to PersistorManager", (done) ->
|
||||
@handler.getFile @bucket, @key, {start: 0, end: 8}, =>
|
||||
expect(@PersistorManager.getFileStream.lastCall.args[2].start).to.equal 0
|
||||
expect(@PersistorManager.getFileStream.lastCall.args[2].end).to.equal 8
|
||||
done()
|
||||
|
||||
|
||||
describe "_getConvertedFile", ->
|
||||
|
||||
it "should getFileStream if it does exists", (done)->
|
||||
|
@ -178,7 +192,3 @@ describe "FileHandler", ->
|
|||
@FileConverter.convert.calledWith(@stubbedPath, @format).should.equal true
|
||||
@LocalFileWriter.deleteFile.calledWith(@stubbedPath).should.equal true
|
||||
done()
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue