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

20 lines
619 B
JavaScript
Raw 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-07-26 05:26:11 +00:00
const fs = new FileSender(archive);
2018-02-21 04:31:27 +00:00
const file = await fs.upload();
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
});
});
});