mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
uncomment tests
This commit is contained in:
parent
f9b6b3dda8
commit
2168f20715
2 changed files with 225 additions and 225 deletions
|
@ -1,222 +1,222 @@
|
||||||
# Client = require "./helpers/Client"
|
Client = require "./helpers/Client"
|
||||||
# request = require "request"
|
request = require "request"
|
||||||
# require("chai").should()
|
require("chai").should()
|
||||||
# sinon = require "sinon"
|
sinon = require "sinon"
|
||||||
# ClsiApp = require "./helpers/ClsiApp"
|
ClsiApp = require "./helpers/ClsiApp"
|
||||||
|
|
||||||
# host = "localhost"
|
host = "localhost"
|
||||||
|
|
||||||
# Server =
|
Server =
|
||||||
# run: () ->
|
run: () ->
|
||||||
# express = require "express"
|
express = require "express"
|
||||||
# app = express()
|
app = express()
|
||||||
|
|
||||||
# staticServer = express.static __dirname + "/../fixtures/"
|
staticServer = express.static __dirname + "/../fixtures/"
|
||||||
# app.get "/:random_id/*", (req, res, next) =>
|
app.get "/:random_id/*", (req, res, next) =>
|
||||||
# @getFile(req.url)
|
@getFile(req.url)
|
||||||
# req.url = "/" + req.params[0]
|
req.url = "/" + req.params[0]
|
||||||
# staticServer(req, res, next)
|
staticServer(req, res, next)
|
||||||
|
|
||||||
# app.listen 31415, host
|
app.listen 31415, host
|
||||||
|
|
||||||
# getFile: () ->
|
getFile: () ->
|
||||||
|
|
||||||
# randomId: () ->
|
randomId: () ->
|
||||||
# Math.random().toString(16).slice(2)
|
Math.random().toString(16).slice(2)
|
||||||
|
|
||||||
# Server.run()
|
Server.run()
|
||||||
|
|
||||||
# describe "Url Caching", ->
|
describe "Url Caching", ->
|
||||||
# describe "Downloading an image for the first time", ->
|
describe "Downloading an image for the first time", ->
|
||||||
# before (done) ->
|
before (done) ->
|
||||||
# @project_id = Client.randomId()
|
@project_id = Client.randomId()
|
||||||
# @file = "#{Server.randomId()}/lion.png"
|
@file = "#{Server.randomId()}/lion.png"
|
||||||
# @request =
|
@request =
|
||||||
# resources: [{
|
resources: [{
|
||||||
# path: "main.tex"
|
path: "main.tex"
|
||||||
# content: '''
|
content: '''
|
||||||
# \\documentclass{article}
|
\\documentclass{article}
|
||||||
# \\usepackage{graphicx}
|
\\usepackage{graphicx}
|
||||||
# \\begin{document}
|
\\begin{document}
|
||||||
# \\includegraphics{lion.png}
|
\\includegraphics{lion.png}
|
||||||
# \\end{document}
|
\\end{document}
|
||||||
# '''
|
'''
|
||||||
# }, {
|
}, {
|
||||||
# path: "lion.png"
|
path: "lion.png"
|
||||||
# url: "http://#{host}:31415/#{@file}"
|
url: "http://#{host}:31415/#{@file}"
|
||||||
# }]
|
}]
|
||||||
|
|
||||||
# sinon.spy Server, "getFile"
|
sinon.spy Server, "getFile"
|
||||||
# ClsiApp.ensureRunning =>
|
ClsiApp.ensureRunning =>
|
||||||
# Client.compile @project_id, @request, (@error, @res, @body) => done()
|
Client.compile @project_id, @request, (@error, @res, @body) => done()
|
||||||
|
|
||||||
# afterEach ->
|
afterEach ->
|
||||||
# Server.getFile.restore()
|
Server.getFile.restore()
|
||||||
|
|
||||||
# it "should download the image", ->
|
it "should download the image", ->
|
||||||
# Server.getFile
|
Server.getFile
|
||||||
# .calledWith("/" + @file)
|
.calledWith("/" + @file)
|
||||||
# .should.equal true
|
.should.equal true
|
||||||
|
|
||||||
# describe "When an image is in the cache and the last modified date is unchanged", ->
|
describe "When an image is in the cache and the last modified date is unchanged", ->
|
||||||
# before (done) ->
|
before (done) ->
|
||||||
# @project_id = Client.randomId()
|
@project_id = Client.randomId()
|
||||||
# @file = "#{Server.randomId()}/lion.png"
|
@file = "#{Server.randomId()}/lion.png"
|
||||||
# @request =
|
@request =
|
||||||
# resources: [{
|
resources: [{
|
||||||
# path: "main.tex"
|
path: "main.tex"
|
||||||
# content: '''
|
content: '''
|
||||||
# \\documentclass{article}
|
\\documentclass{article}
|
||||||
# \\usepackage{graphicx}
|
\\usepackage{graphicx}
|
||||||
# \\begin{document}
|
\\begin{document}
|
||||||
# \\includegraphics{lion.png}
|
\\includegraphics{lion.png}
|
||||||
# \\end{document}
|
\\end{document}
|
||||||
# '''
|
'''
|
||||||
# }, @image_resource = {
|
}, @image_resource = {
|
||||||
# path: "lion.png"
|
path: "lion.png"
|
||||||
# url: "http://#{host}:31415/#{@file}"
|
url: "http://#{host}:31415/#{@file}"
|
||||||
# modified: Date.now()
|
modified: Date.now()
|
||||||
# }]
|
}]
|
||||||
|
|
||||||
# Client.compile @project_id, @request, (@error, @res, @body) =>
|
Client.compile @project_id, @request, (@error, @res, @body) =>
|
||||||
# sinon.spy Server, "getFile"
|
sinon.spy Server, "getFile"
|
||||||
# Client.compile @project_id, @request, (@error, @res, @body) =>
|
Client.compile @project_id, @request, (@error, @res, @body) =>
|
||||||
# done()
|
done()
|
||||||
|
|
||||||
# after ->
|
after ->
|
||||||
# Server.getFile.restore()
|
Server.getFile.restore()
|
||||||
|
|
||||||
# it "should not download the image again", ->
|
it "should not download the image again", ->
|
||||||
# Server.getFile.called.should.equal false
|
Server.getFile.called.should.equal false
|
||||||
|
|
||||||
# describe "When an image is in the cache and the last modified date is advanced", ->
|
describe "When an image is in the cache and the last modified date is advanced", ->
|
||||||
# before (done) ->
|
before (done) ->
|
||||||
# @project_id = Client.randomId()
|
@project_id = Client.randomId()
|
||||||
# @file = "#{Server.randomId()}/lion.png"
|
@file = "#{Server.randomId()}/lion.png"
|
||||||
# @request =
|
@request =
|
||||||
# resources: [{
|
resources: [{
|
||||||
# path: "main.tex"
|
path: "main.tex"
|
||||||
# content: '''
|
content: '''
|
||||||
# \\documentclass{article}
|
\\documentclass{article}
|
||||||
# \\usepackage{graphicx}
|
\\usepackage{graphicx}
|
||||||
# \\begin{document}
|
\\begin{document}
|
||||||
# \\includegraphics{lion.png}
|
\\includegraphics{lion.png}
|
||||||
# \\end{document}
|
\\end{document}
|
||||||
# '''
|
'''
|
||||||
# }, @image_resource = {
|
}, @image_resource = {
|
||||||
# path: "lion.png"
|
path: "lion.png"
|
||||||
# url: "http://#{host}:31415/#{@file}"
|
url: "http://#{host}:31415/#{@file}"
|
||||||
# modified: @last_modified = Date.now()
|
modified: @last_modified = Date.now()
|
||||||
# }]
|
}]
|
||||||
|
|
||||||
# Client.compile @project_id, @request, (@error, @res, @body) =>
|
Client.compile @project_id, @request, (@error, @res, @body) =>
|
||||||
# sinon.spy Server, "getFile"
|
sinon.spy Server, "getFile"
|
||||||
# @image_resource.modified = new Date(@last_modified + 3000)
|
@image_resource.modified = new Date(@last_modified + 3000)
|
||||||
# Client.compile @project_id, @request, (@error, @res, @body) =>
|
Client.compile @project_id, @request, (@error, @res, @body) =>
|
||||||
# done()
|
done()
|
||||||
|
|
||||||
# afterEach ->
|
afterEach ->
|
||||||
# Server.getFile.restore()
|
Server.getFile.restore()
|
||||||
|
|
||||||
# it "should download the image again", ->
|
it "should download the image again", ->
|
||||||
# Server.getFile.called.should.equal true
|
Server.getFile.called.should.equal true
|
||||||
|
|
||||||
# describe "When an image is in the cache and the last modified date is further in the past", ->
|
describe "When an image is in the cache and the last modified date is further in the past", ->
|
||||||
# before (done) ->
|
before (done) ->
|
||||||
# @project_id = Client.randomId()
|
@project_id = Client.randomId()
|
||||||
# @file = "#{Server.randomId()}/lion.png"
|
@file = "#{Server.randomId()}/lion.png"
|
||||||
# @request =
|
@request =
|
||||||
# resources: [{
|
resources: [{
|
||||||
# path: "main.tex"
|
path: "main.tex"
|
||||||
# content: '''
|
content: '''
|
||||||
# \\documentclass{article}
|
\\documentclass{article}
|
||||||
# \\usepackage{graphicx}
|
\\usepackage{graphicx}
|
||||||
# \\begin{document}
|
\\begin{document}
|
||||||
# \\includegraphics{lion.png}
|
\\includegraphics{lion.png}
|
||||||
# \\end{document}
|
\\end{document}
|
||||||
# '''
|
'''
|
||||||
# }, @image_resource = {
|
}, @image_resource = {
|
||||||
# path: "lion.png"
|
path: "lion.png"
|
||||||
# url: "http://#{host}:31415/#{@file}"
|
url: "http://#{host}:31415/#{@file}"
|
||||||
# modified: @last_modified = Date.now()
|
modified: @last_modified = Date.now()
|
||||||
# }]
|
}]
|
||||||
|
|
||||||
# Client.compile @project_id, @request, (@error, @res, @body) =>
|
Client.compile @project_id, @request, (@error, @res, @body) =>
|
||||||
# sinon.spy Server, "getFile"
|
sinon.spy Server, "getFile"
|
||||||
# @image_resource.modified = new Date(@last_modified - 3000)
|
@image_resource.modified = new Date(@last_modified - 3000)
|
||||||
# Client.compile @project_id, @request, (@error, @res, @body) =>
|
Client.compile @project_id, @request, (@error, @res, @body) =>
|
||||||
# done()
|
done()
|
||||||
|
|
||||||
# afterEach ->
|
afterEach ->
|
||||||
# Server.getFile.restore()
|
Server.getFile.restore()
|
||||||
|
|
||||||
# it "should not download the image again", ->
|
it "should not download the image again", ->
|
||||||
# Server.getFile.called.should.equal false
|
Server.getFile.called.should.equal false
|
||||||
|
|
||||||
# describe "When an image is in the cache and the last modified date is not specified", ->
|
describe "When an image is in the cache and the last modified date is not specified", ->
|
||||||
# before (done) ->
|
before (done) ->
|
||||||
# @project_id = Client.randomId()
|
@project_id = Client.randomId()
|
||||||
# @file = "#{Server.randomId()}/lion.png"
|
@file = "#{Server.randomId()}/lion.png"
|
||||||
# @request =
|
@request =
|
||||||
# resources: [{
|
resources: [{
|
||||||
# path: "main.tex"
|
path: "main.tex"
|
||||||
# content: '''
|
content: '''
|
||||||
# \\documentclass{article}
|
\\documentclass{article}
|
||||||
# \\usepackage{graphicx}
|
\\usepackage{graphicx}
|
||||||
# \\begin{document}
|
\\begin{document}
|
||||||
# \\includegraphics{lion.png}
|
\\includegraphics{lion.png}
|
||||||
# \\end{document}
|
\\end{document}
|
||||||
# '''
|
'''
|
||||||
# }, @image_resource = {
|
}, @image_resource = {
|
||||||
# path: "lion.png"
|
path: "lion.png"
|
||||||
# url: "http://#{host}:31415/#{@file}"
|
url: "http://#{host}:31415/#{@file}"
|
||||||
# modified: @last_modified = Date.now()
|
modified: @last_modified = Date.now()
|
||||||
# }]
|
}]
|
||||||
|
|
||||||
# Client.compile @project_id, @request, (@error, @res, @body) =>
|
Client.compile @project_id, @request, (@error, @res, @body) =>
|
||||||
# sinon.spy Server, "getFile"
|
sinon.spy Server, "getFile"
|
||||||
# delete @image_resource.modified
|
delete @image_resource.modified
|
||||||
# Client.compile @project_id, @request, (@error, @res, @body) =>
|
Client.compile @project_id, @request, (@error, @res, @body) =>
|
||||||
# done()
|
done()
|
||||||
|
|
||||||
# afterEach ->
|
afterEach ->
|
||||||
# Server.getFile.restore()
|
Server.getFile.restore()
|
||||||
|
|
||||||
# it "should download the image again", ->
|
it "should download the image again", ->
|
||||||
# Server.getFile.called.should.equal true
|
Server.getFile.called.should.equal true
|
||||||
|
|
||||||
# describe "After clearing the cache", ->
|
describe "After clearing the cache", ->
|
||||||
# before (done) ->
|
before (done) ->
|
||||||
# @project_id = Client.randomId()
|
@project_id = Client.randomId()
|
||||||
# @file = "#{Server.randomId()}/lion.png"
|
@file = "#{Server.randomId()}/lion.png"
|
||||||
# @request =
|
@request =
|
||||||
# resources: [{
|
resources: [{
|
||||||
# path: "main.tex"
|
path: "main.tex"
|
||||||
# content: '''
|
content: '''
|
||||||
# \\documentclass{article}
|
\\documentclass{article}
|
||||||
# \\usepackage{graphicx}
|
\\usepackage{graphicx}
|
||||||
# \\begin{document}
|
\\begin{document}
|
||||||
# \\includegraphics{lion.png}
|
\\includegraphics{lion.png}
|
||||||
# \\end{document}
|
\\end{document}
|
||||||
# '''
|
'''
|
||||||
# }, @image_resource = {
|
}, @image_resource = {
|
||||||
# path: "lion.png"
|
path: "lion.png"
|
||||||
# url: "http://#{host}:31415/#{@file}"
|
url: "http://#{host}:31415/#{@file}"
|
||||||
# modified: @last_modified = Date.now()
|
modified: @last_modified = Date.now()
|
||||||
# }]
|
}]
|
||||||
|
|
||||||
# Client.compile @project_id, @request, (error) =>
|
Client.compile @project_id, @request, (error) =>
|
||||||
# throw error if error?
|
throw error if error?
|
||||||
# Client.clearCache @project_id, (error, res, body) =>
|
Client.clearCache @project_id, (error, res, body) =>
|
||||||
# throw error if error?
|
throw error if error?
|
||||||
# sinon.spy Server, "getFile"
|
sinon.spy Server, "getFile"
|
||||||
# Client.compile @project_id, @request, (@error, @res, @body) =>
|
Client.compile @project_id, @request, (@error, @res, @body) =>
|
||||||
# done()
|
done()
|
||||||
|
|
||||||
# afterEach ->
|
afterEach ->
|
||||||
# Server.getFile.restore()
|
Server.getFile.restore()
|
||||||
|
|
||||||
# it "should download the image again", ->
|
it "should download the image again", ->
|
||||||
# Server.getFile.called.should.equal true
|
Server.getFile.called.should.equal true
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
# Client = require "./helpers/Client"
|
Client = require "./helpers/Client"
|
||||||
# request = require "request"
|
request = require "request"
|
||||||
# require("chai").should()
|
require("chai").should()
|
||||||
# expect = require("chai").expect
|
expect = require("chai").expect
|
||||||
# path = require("path")
|
path = require("path")
|
||||||
# fs = require("fs")
|
fs = require("fs")
|
||||||
# ClsiApp = require "./helpers/ClsiApp"
|
ClsiApp = require "./helpers/ClsiApp"
|
||||||
|
|
||||||
# describe "Syncing", ->
|
describe "Syncing", ->
|
||||||
# before (done) ->
|
before (done) ->
|
||||||
# @request =
|
@request =
|
||||||
# resources: [
|
resources: [
|
||||||
# path: "main.tex"
|
path: "main.tex"
|
||||||
# content: fs.readFileSync(path.join(__dirname,"../fixtures/naugty_strings.txt"),"utf-8")
|
content: fs.readFileSync(path.join(__dirname,"../fixtures/naugty_strings.txt"),"utf-8")
|
||||||
# ]
|
]
|
||||||
# @project_id = Client.randomId()
|
@project_id = Client.randomId()
|
||||||
# ClsiApp.ensureRunning =>
|
ClsiApp.ensureRunning =>
|
||||||
# Client.compile @project_id, @request, (@error, @res, @body) => done()
|
Client.compile @project_id, @request, (@error, @res, @body) => done()
|
||||||
|
|
||||||
# describe "wordcount file", ->
|
describe "wordcount file", ->
|
||||||
# it "should return wordcount info", (done) ->
|
it "should return wordcount info", (done) ->
|
||||||
# Client.wordcount @project_id, "main.tex", (error, result) ->
|
Client.wordcount @project_id, "main.tex", (error, result) ->
|
||||||
# throw error if error?
|
throw error if error?
|
||||||
# expect(result).to.deep.equal(
|
expect(result).to.deep.equal(
|
||||||
# texcount: {
|
texcount: {
|
||||||
# encode: "utf8"
|
encode: "utf8"
|
||||||
# textWords: 2281
|
textWords: 2281
|
||||||
# headWords: 2
|
headWords: 2
|
||||||
# outside: 0
|
outside: 0
|
||||||
# headers: 2
|
headers: 2
|
||||||
# elements: 0
|
elements: 0
|
||||||
# mathInline: 6
|
mathInline: 6
|
||||||
# mathDisplay: 0
|
mathDisplay: 0
|
||||||
# errors: 0
|
errors: 0
|
||||||
# messages: ""
|
messages: ""
|
||||||
# }
|
}
|
||||||
# )
|
)
|
||||||
# done()
|
done()
|
||||||
|
|
Loading…
Reference in a new issue