mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-26 07:11:03 +00:00
39 lines
998 B
CoffeeScript
39 lines
998 B
CoffeeScript
|
|
assert = require("chai").assert
|
|
sinon = require('sinon')
|
|
chai = require('chai')
|
|
should = chai.should()
|
|
expect = chai.expect
|
|
modulePath = "../../../app/js/KeyBuilder.js"
|
|
SandboxedModule = require('sandboxed-module')
|
|
|
|
describe "LocalFileWriter", ->
|
|
|
|
beforeEach ->
|
|
|
|
@keyBuilder = SandboxedModule.require modulePath, requires:
|
|
"logger-sharelatex":
|
|
log:->
|
|
err:->
|
|
@key = "123/456"
|
|
|
|
describe "cachedKey", ->
|
|
|
|
it "should add the fomat on", ->
|
|
opts =
|
|
format: "png"
|
|
newKey = @keyBuilder.addCachingToKey @key, opts
|
|
newKey.should.equal "#{@key}-converted-cache/format-png"
|
|
|
|
it "should add the style on", ->
|
|
opts =
|
|
style: "thumbnail"
|
|
newKey = @keyBuilder.addCachingToKey @key, opts
|
|
newKey.should.equal "#{@key}-converted-cache/style-thumbnail"
|
|
|
|
it "should add format on first", ->
|
|
opts =
|
|
style: "thumbnail"
|
|
format: "png"
|
|
newKey = @keyBuilder.addCachingToKey @key, opts
|
|
newKey.should.equal "#{@key}-converted-cache/format-png-style-thumbnail"
|