[misc] wordcount: restrict image to an allow list and add tests

This commit is contained in:
Jakob Ackermann
2020-06-26 13:17:45 +01:00
parent 5ed09d1a98
commit 6edb458910
4 changed files with 86 additions and 2 deletions

View File

@@ -70,4 +70,33 @@ Hello world
expect(pdf).to.not.exist
})
})
describe('wordcount', function() {
beforeEach(function(done) {
Client.compile(this.project_id, this.request, done)
})
it('should error out with an invalid imageName', function() {
Client.wordcountWithImage(
this.project_id,
'main.tex',
'something/evil:1337',
(error, result) => {
expect(String(error)).to.include('statusCode=400')
}
)
})
it('should produce a texcout a valid imageName', function() {
Client.wordcountWithImage(
this.project_id,
'main.tex',
process.env.TEXLIVE_IMAGE,
(error, result) => {
expect(error).to.not.exist
expect(result).to.exist
expect(result.texcount).to.exist
}
)
})
})
})