1
0
mirror of https://gitlab.com/timvisee/send.git synced 2024-11-14 15:12:48 +01:00
send/test/frontend/tests/fileSender-tests.js

20 lines
619 B
JavaScript
Raw Normal View History

2018-02-21 05:31:27 +01:00
import assert from 'assert';
import FileSender from '../../../app/fileSender';
2018-07-26 07:26:11 +02:00
import Archive from '../../../app/archive';
2018-02-21 05:31:27 +01:00
// FileSender uses a File in real life but a Blob works for testing
const blob = new Blob(['hello world!'], { type: 'text/plain' });
blob.name = 'text.txt';
2018-07-26 07:26:11 +02:00
const archive = new Archive([blob]);
2018-02-21 05:31:27 +01:00
describe('FileSender', function() {
describe('upload', function() {
it('returns an OwnedFile on success', async function() {
2018-07-26 07:26:11 +02:00
const fs = new FileSender(archive);
2018-02-21 05:31:27 +01:00
const file = await fs.upload();
assert.ok(file.id);
2018-07-26 07:26:11 +02:00
assert.equal(file.name, archive.name);
2018-02-21 05:31:27 +01:00
});
});
});