|
|
@@ -36,50 +36,58 @@ describe "FileTypeManager", ->
|
|
|
@callback.calledWith(null, false).should.equal true
|
|
|
|
|
|
describe "isBinary", ->
|
|
|
+ beforeEach ->
|
|
|
+ @stat = { size: 100 }
|
|
|
+ @fs.stat = sinon.stub().callsArgWith(1, null, @stat)
|
|
|
+
|
|
|
it "should return .tex files as not binary", ->
|
|
|
- @FileTypeManager.isBinary "file.tex", (error, binary) ->
|
|
|
+ @FileTypeManager.isBinary "file.tex", "/path/on/disk", (error, binary) ->
|
|
|
binary.should.equal false
|
|
|
|
|
|
it "should return .bib files as not binary", ->
|
|
|
- @FileTypeManager.isBinary "file.bib", (error, binary) ->
|
|
|
+ @FileTypeManager.isBinary "file.bib", "/path/on/disk", (error, binary) ->
|
|
|
binary.should.equal false
|
|
|
|
|
|
it "should return .bibtex files as not binary", ->
|
|
|
- @FileTypeManager.isBinary "file.bibtex", (error, binary) ->
|
|
|
+ @FileTypeManager.isBinary "file.bibtex", "/path/on/disk", (error, binary) ->
|
|
|
binary.should.equal false
|
|
|
|
|
|
it "should return .cls files as not binary", ->
|
|
|
- @FileTypeManager.isBinary "file.cls", (error, binary) ->
|
|
|
+ @FileTypeManager.isBinary "file.cls", "/path/on/disk", (error, binary) ->
|
|
|
binary.should.equal false
|
|
|
|
|
|
it "should return .sty files as not binary", ->
|
|
|
- @FileTypeManager.isBinary "file.sty", (error, binary) ->
|
|
|
+ @FileTypeManager.isBinary "file.sty", "/path/on/disk", (error, binary) ->
|
|
|
binary.should.equal false
|
|
|
|
|
|
it "should return .bst files as not binary", ->
|
|
|
- @FileTypeManager.isBinary "file.bst", (error, binary) ->
|
|
|
+ @FileTypeManager.isBinary "file.bst", "/path/on/disk", (error, binary) ->
|
|
|
binary.should.equal false
|
|
|
|
|
|
it "should return .eps files as binary", ->
|
|
|
- @FileTypeManager.isBinary "file.eps", (error, binary) ->
|
|
|
+ @FileTypeManager.isBinary "file.eps", "/path/on/disk", (error, binary) ->
|
|
|
binary.should.equal true
|
|
|
|
|
|
it "should return .dvi files as binary", ->
|
|
|
- @FileTypeManager.isBinary "file.dvi", (error, binary) ->
|
|
|
+ @FileTypeManager.isBinary "file.dvi", "/path/on/disk", (error, binary) ->
|
|
|
binary.should.equal true
|
|
|
|
|
|
it "should return .png files as binary", ->
|
|
|
- @FileTypeManager.isBinary "file.png", (error, binary) ->
|
|
|
+ @FileTypeManager.isBinary "file.png", "/path/on/disk", (error, binary) ->
|
|
|
binary.should.equal true
|
|
|
|
|
|
it "should return files without extensions as binary", ->
|
|
|
- @FileTypeManager.isBinary "tex", (error, binary) ->
|
|
|
+ @FileTypeManager.isBinary "tex", "/path/on/disk", (error, binary) ->
|
|
|
binary.should.equal true
|
|
|
|
|
|
it "should ignore the case of an extension", ->
|
|
|
- @FileTypeManager.isBinary "file.TEX", (error, binary) ->
|
|
|
+ @FileTypeManager.isBinary "file.TEX", "/path/on/disk", (error, binary) ->
|
|
|
binary.should.equal false
|
|
|
-
|
|
|
+
|
|
|
+ it "should return large text files as binary", ->
|
|
|
+ @stat.size = 2 * 1024 * 1024 # 2Mb
|
|
|
+ @FileTypeManager.isBinary "file.tex", "/path/on/disk", (error, binary) ->
|
|
|
+ binary.should.equal true
|
|
|
|
|
|
describe "shouldIgnore", ->
|
|
|
it "should ignore tex auxiliary files", ->
|