mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 21:59:00 +02:00
Add acceptance tests for directory deletion
This commit is contained in:
@@ -252,7 +252,7 @@ describe('Filestore', function() {
|
||||
})
|
||||
|
||||
describe('with multiple files', function() {
|
||||
let fileIds, fileUrls
|
||||
let fileIds, fileUrls, projectUrl
|
||||
const localFileReadPaths = [
|
||||
'/tmp/filestore_acceptance_tests_file_read_1.txt',
|
||||
'/tmp/filestore_acceptance_tests_file_read_2.txt'
|
||||
@@ -278,10 +278,11 @@ describe('Filestore', function() {
|
||||
})
|
||||
|
||||
beforeEach(async function() {
|
||||
projectUrl = `${filestoreUrl}/project/${projectId}`
|
||||
fileIds = [ObjectId().toString(), ObjectId().toString()]
|
||||
fileUrls = [
|
||||
`${filestoreUrl}/project/${projectId}/file/${fileIds[0]}`,
|
||||
`${filestoreUrl}/project/${projectId}/file/${fileIds[1]}`
|
||||
`${projectUrl}/file/${fileIds[0]}`,
|
||||
`${projectUrl}/file/${fileIds[1]}`
|
||||
]
|
||||
|
||||
const writeStreams = [
|
||||
@@ -311,6 +312,34 @@ describe('Filestore', function() {
|
||||
constantFileContents[0].length + constantFileContents[1].length
|
||||
)
|
||||
})
|
||||
|
||||
it('should store the files', async function() {
|
||||
for (const index in fileUrls) {
|
||||
await expect(rp.get(fileUrls[index])).to.eventually.have.property(
|
||||
'body',
|
||||
constantFileContents[index]
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
it('should be able to delete the project', async function() {
|
||||
await expect(rp.delete(projectUrl)).to.eventually.have.property(
|
||||
'statusCode',
|
||||
204
|
||||
)
|
||||
|
||||
for (const index in fileUrls) {
|
||||
await expect(
|
||||
rp.get(fileUrls[index])
|
||||
).to.eventually.be.rejected.and.have.property('statusCode', 404)
|
||||
}
|
||||
})
|
||||
|
||||
it('should not delete a partial project id', async function() {
|
||||
await expect(
|
||||
rp.delete(`${filestoreUrl}/project/5`)
|
||||
).to.eventually.be.rejected.and.have.property('statusCode', 400)
|
||||
})
|
||||
})
|
||||
|
||||
describe('with a large file', function() {
|
||||
|
||||
Reference in New Issue
Block a user