mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 20:43:41 -05: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"
|