drop.chapril.org-firefoxsend/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-08-31 23:20:15 +02:00
const fs = new FileSender();
const file = await fs.upload(archive);
2018-02-21 05:31:27 +01:00
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
});
});
});