Skip to content

Commit b1c2eab

Browse files
gormedbhstahl
authored andcommitted
removed unnecessary tests
1 parent 92f0346 commit b1c2eab

File tree

1 file changed

+0
-143
lines changed

1 file changed

+0
-143
lines changed

test/Test-EndToEnd.js

Lines changed: 0 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -229,44 +229,7 @@ describe('EndToEnd', () => {
229229
agent = request.agent(server.listen());
230230
});
231231

232-
after((done) => {
233-
// Remove the files directory
234-
exec(`rm -r ${FILES_DIRECTORY}`, (err) => {
235-
if (err) {
236-
return done(err);
237-
}
238-
239-
// clear the config
240-
server.datastore.configstore.clear();
241-
return done();
242-
});
243-
});
244-
245-
describe('HEAD', () => {
246-
it('should 404 file ids that dont exist', (done) => {
247-
agent.head(`${STORE_PATH}/${file_id}`)
248-
.set('Tus-Resumable', TUS_RESUMABLE)
249-
.expect(404)
250-
.expect('Tus-Resumable', TUS_RESUMABLE)
251-
.end(done);
252-
});
253-
});
254-
255232
describe('POST', () => {
256-
it('should create a file that will be deleted', (done) => {
257-
agent.post(STORE_PATH)
258-
.set('Tus-Resumable', TUS_RESUMABLE)
259-
.set('Upload-Defer-Length', 1)
260-
.set('Tus-Resumable', TUS_RESUMABLE)
261-
.expect(201)
262-
.end((err, res) => {
263-
assert.equal('location' in res.headers, true);
264-
assert.equal(res.headers['tus-resumable'], TUS_RESUMABLE);
265-
// Save the id for subsequent tests
266-
file_to_delete = res.headers.location.split('/').pop();
267-
done();
268-
});
269-
});
270233

271234
it('should create a file and respond with its _relative_ location', (done) => {
272235
agent.post(STORE_PATH)
@@ -285,112 +248,6 @@ describe('EndToEnd', () => {
285248
done();
286249
});
287250
});
288-
289-
it('should create a file with a deferred length', (done) => {
290-
agent.post(STORE_PATH)
291-
.set('Tus-Resumable', TUS_RESUMABLE)
292-
.set('Upload-Defer-Length', 1)
293-
.set('Upload-Metadata', TEST_METADATA)
294-
.set('Tus-Resumable', TUS_RESUMABLE)
295-
.expect(201)
296-
.end((err, res) => {
297-
assert.equal('location' in res.headers, true);
298-
assert.equal(res.headers['tus-resumable'], TUS_RESUMABLE);
299-
// Save the id for subsequent tests
300-
deferred_file_id = res.headers.location.split('/').pop();
301-
done();
302-
});
303-
});
304-
});
305-
306-
describe('HEAD', () => {
307-
before((done) => {
308-
// Remove the file to delete for 410 Gone test
309-
exec(`rm ${FILES_DIRECTORY}/${file_to_delete}`, () => {
310-
return done();
311-
});
312-
});
313-
314-
it('should return 410 Gone for the file that has been deleted', (done) => {
315-
agent.head(`${STORE_PATH}/${file_to_delete}`)
316-
.set('Tus-Resumable', TUS_RESUMABLE)
317-
.expect(410)
318-
.expect('Tus-Resumable', TUS_RESUMABLE)
319-
.end(done);
320-
});
321-
322-
it('should return a starting offset, metadata for the new file', (done) => {
323-
agent.head(`${STORE_PATH}/${file_id}`)
324-
.set('Tus-Resumable', TUS_RESUMABLE)
325-
.expect(200)
326-
.expect('Upload-Metadata', TEST_METADATA)
327-
.expect('Upload-Offset', 0)
328-
.expect('Upload-Length', TEST_FILE_SIZE)
329-
.expect('Tus-Resumable', TUS_RESUMABLE)
330-
.end(done);
331-
});
332-
333-
it('should return the defer length of the new deferred file', (done) => {
334-
agent.head(`${STORE_PATH}/${deferred_file_id}`)
335-
.set('Tus-Resumable', TUS_RESUMABLE)
336-
.expect(200)
337-
.expect('Upload-Offset', 0)
338-
.expect('Upload-Defer-Length', 1)
339-
.expect('Tus-Resumable', TUS_RESUMABLE)
340-
.end(done);
341-
});
342-
});
343-
344-
describe('PATCH', () => {
345-
it('should 404 paths without a file id', (done) => {
346-
agent.patch(`${STORE_PATH}/`)
347-
.set('Tus-Resumable', TUS_RESUMABLE)
348-
.set('Upload-Offset', 0)
349-
.set('Content-Type', 'application/offset+octet-stream')
350-
.expect(404)
351-
.expect('Tus-Resumable', TUS_RESUMABLE)
352-
.end(done);
353-
});
354-
355-
it('should 404 paths that do not exist', (done) => {
356-
agent.patch(`${STORE_PATH}/dont_exist`)
357-
.set('Tus-Resumable', TUS_RESUMABLE)
358-
.set('Upload-Offset', 0)
359-
.set('Content-Type', 'application/offset+octet-stream')
360-
.expect(404)
361-
.expect('Tus-Resumable', TUS_RESUMABLE)
362-
.end(done);
363-
});
364-
365-
it('should upload the file', (done) => {
366-
const read_stream = fs.createReadStream(TEST_FILE_PATH);
367-
const write_stream = agent.patch(`${STORE_PATH}/${file_id}`)
368-
.set('Tus-Resumable', TUS_RESUMABLE)
369-
.set('Upload-Offset', 0)
370-
.set('Content-Type', 'application/offset+octet-stream');
371-
372-
write_stream.on('response', (res) => {
373-
assert.equal(res.statusCode, 204);
374-
assert.equal(res.header['tus-resumable'], TUS_RESUMABLE);
375-
assert.equal(res.header['upload-offset'], `${TEST_FILE_SIZE}`);
376-
done();
377-
});
378-
379-
read_stream.pipe(write_stream);
380-
});
381-
});
382-
383-
describe('HEAD', () => {
384-
it('should return the ending offset of the uploaded file', (done) => {
385-
agent.head(`${STORE_PATH}/${file_id}`)
386-
.set('Tus-Resumable', TUS_RESUMABLE)
387-
.expect(200)
388-
.expect('Upload-Metadata', TEST_METADATA)
389-
.expect('Upload-Offset', TEST_FILE_SIZE)
390-
.expect('Upload-Length', TEST_FILE_SIZE)
391-
.expect('Tus-Resumable', TUS_RESUMABLE)
392-
.end(done);
393-
});
394251
});
395252
});
396253

0 commit comments

Comments
 (0)