Add one to size of line.

To account for newline characters in the original document
This commit is contained in:
Shane Kilkelly 2016-05-12 09:26:50 +01:00
parent 82d5a7fafd
commit 048fd19418
2 changed files with 2 additions and 2 deletions

View file

@ -33,7 +33,7 @@ module.exports = HttpController =
_getTotalSizeOfLines: (lines) -> _getTotalSizeOfLines: (lines) ->
size = 0 size = 0
for line in lines for line in lines
size += line.length size += (line.length + 1)
return size return size
setDoc: (req, res, next = (error) ->) -> setDoc: (req, res, next = (error) ->) ->

View file

@ -70,7 +70,7 @@ describe "HttpController.setDoc", ->
describe "when the payload is too large", -> describe "when the payload is too large", ->
beforeEach -> beforeEach ->
lines = [] lines = []
for _ in [0..300000] for _ in [0..200000]
lines.push "test test test" lines.push "test test test"
@req.body.lines = lines @req.body.lines = lines
@DocumentManager.setDocWithLock = sinon.stub().callsArgWith(5) @DocumentManager.setDocWithLock = sinon.stub().callsArgWith(5)