fox-send/test/frontend/tests/fileSender-tests.js

20 lines
619 B
JavaScript
Raw Permalink Normal View History

2018-02-21 04:31:27 +00:00
import assert from 'assert';
import FileSender from '../../../app/fileSender';
2018-07-26 05:26:11 +00:00
import Archive from '../../../app/archive';
2018-02-21 04:31:27 +00: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 05:26:11 +00:00
const archive = new Archive([blob]);
2018-02-21 04:31:27 +00:00
describe('FileSender', function() {
describe('upload', function() {
it('returns an OwnedFile on success', async function() {
2018-08-31 21:20:15 +00:00
const fs = new FileSender();
const file = await fs.upload(archive);
2018-02-21 04:31:27 +00:00
assert.ok(file.id);
2018-07-26 05:26:11 +00:00
assert.equal(file.name, archive.name);
2018-02-21 04:31:27 +00:00
});
});
});