mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-08 19:50:47 +00:00
Add acceptance test for large files
This commit is contained in:
parent
2f2a819b74
commit
9e7eec7a19
1 changed files with 32 additions and 0 deletions
|
@ -368,6 +368,38 @@ describe('Filestore', function() {
|
|||
})
|
||||
})
|
||||
|
||||
describe('with a large file', function() {
|
||||
let fileId, fileUrl, largeFileContent, error
|
||||
|
||||
beforeEach(async function() {
|
||||
fileId = Math.random()
|
||||
fileUrl = `${filestoreUrl}/project/${projectId}/file/${directoryName}%2F${fileId}`
|
||||
|
||||
largeFileContent = '_wombat_'.repeat(1024 * 1024) // 8 megabytes
|
||||
largeFileContent += Math.random()
|
||||
|
||||
const writeStream = request.post(fileUrl)
|
||||
const readStream = streamifier.createReadStream(largeFileContent)
|
||||
// hack to consume the result to ensure the http request has been fully processed
|
||||
const resultStream = fs.createWriteStream('/dev/null')
|
||||
|
||||
try {
|
||||
await pipeline(readStream, writeStream, resultStream)
|
||||
} catch (err) {
|
||||
error = err
|
||||
}
|
||||
})
|
||||
|
||||
it('should be able to get the file back', async function() {
|
||||
const response = await rp.get(fileUrl)
|
||||
expect(response.body).to.equal(largeFileContent)
|
||||
})
|
||||
|
||||
it('should not throw an error', function() {
|
||||
expect(error).not.to.exist
|
||||
})
|
||||
})
|
||||
|
||||
if (backend === 'S3Persistor') {
|
||||
describe('with a file in a specific bucket', function() {
|
||||
let constantFileContent, fileId, fileUrl, bucketName
|
||||
|
|
Loading…
Add table
Reference in a new issue