drop.chapril.org-firefoxsend/test/frontend/tests/fileSender-tests.js
2018-08-31 14:30:50 -07:00

20 lines
619 B
JavaScript

import assert from 'assert';
import FileSender from '../../../app/fileSender';
import Archive from '../../../app/archive';
// 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';
const archive = new Archive([blob]);
describe('FileSender', function() {
describe('upload', function() {
it('returns an OwnedFile on success', async function() {
const fs = new FileSender();
const file = await fs.upload(archive);
assert.ok(file.id);
assert.equal(file.name, archive.name);
});
});
});