From ed980a21e19caa0088d3d78a5b58c681fc048d59 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Fri, 28 Aug 2015 13:50:40 +0100 Subject: [PATCH] Test the FileHandler layer. --- .../test/unit/coffee/FileHandlerTests.coffee | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/services/filestore/test/unit/coffee/FileHandlerTests.coffee b/services/filestore/test/unit/coffee/FileHandlerTests.coffee index 5457defd16..74ca9975da 100644 --- a/services/filestore/test/unit/coffee/FileHandlerTests.coffee +++ b/services/filestore/test/unit/coffee/FileHandlerTests.coffee @@ -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() - - - -