2020-02-19 06:16:00 -05:00
|
|
|
/*
|
|
|
|
* decaffeinate suggestions:
|
|
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
* DS207: Consider shorter variations of null checks
|
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
*/
|
|
|
|
const Client = require("./helpers/Client");
|
|
|
|
const request = require("request");
|
|
|
|
require("chai").should();
|
|
|
|
const { expect } = require("chai");
|
|
|
|
const path = require("path");
|
|
|
|
const fs = require("fs");
|
|
|
|
const ClsiApp = require("./helpers/ClsiApp");
|
2015-09-09 08:52:45 -04:00
|
|
|
|
2020-02-19 06:16:00 -05:00
|
|
|
describe("Syncing", function() {
|
|
|
|
before(function(done) {
|
|
|
|
this.request = {
|
|
|
|
resources: [{
|
|
|
|
path: "main.tex",
|
2018-03-02 12:59:37 -05:00
|
|
|
content: fs.readFileSync(path.join(__dirname,"../fixtures/naugty_strings.txt"),"utf-8")
|
2020-02-19 06:16:00 -05:00
|
|
|
}
|
2018-03-02 12:59:37 -05:00
|
|
|
]
|
2020-02-19 06:16:00 -05:00
|
|
|
};
|
|
|
|
this.project_id = Client.randomId();
|
|
|
|
return ClsiApp.ensureRunning(() => {
|
|
|
|
return Client.compile(this.project_id, this.request, (error, res, body) => { this.error = error; this.res = res; this.body = body; return done(); });
|
|
|
|
});
|
|
|
|
});
|
2015-09-09 08:52:45 -04:00
|
|
|
|
2020-02-19 06:16:00 -05:00
|
|
|
return describe("wordcount file", () =>
|
|
|
|
it("should return wordcount info", function(done) {
|
|
|
|
return Client.wordcount(this.project_id, "main.tex", function(error, result) {
|
|
|
|
if (error != null) { throw error; }
|
|
|
|
expect(result).to.deep.equal({
|
2018-03-02 12:59:37 -05:00
|
|
|
texcount: {
|
2020-02-19 06:16:00 -05:00
|
|
|
encode: "utf8",
|
|
|
|
textWords: 2281,
|
|
|
|
headWords: 2,
|
|
|
|
outside: 0,
|
|
|
|
headers: 2,
|
|
|
|
elements: 0,
|
|
|
|
mathInline: 6,
|
|
|
|
mathDisplay: 0,
|
|
|
|
errors: 0,
|
2018-03-02 12:59:37 -05:00
|
|
|
messages: ""
|
|
|
|
}
|
2020-02-19 06:16:00 -05:00
|
|
|
});
|
|
|
|
return done();
|
|
|
|
});
|
|
|
|
})
|
|
|
|
);
|
|
|
|
});
|