fileSender-tests.js 619 B

12345678910111213141516171819
  1. import assert from 'assert';
  2. import FileSender from '../../../app/fileSender';
  3. import Archive from '../../../app/archive';
  4. // FileSender uses a File in real life but a Blob works for testing
  5. const blob = new Blob(['hello world!'], { type: 'text/plain' });
  6. blob.name = 'text.txt';
  7. const archive = new Archive([blob]);
  8. describe('FileSender', function() {
  9. describe('upload', function() {
  10. it('returns an OwnedFile on success', async function() {
  11. const fs = new FileSender();
  12. const file = await fs.upload(archive);
  13. assert.ok(file.id);
  14. assert.equal(file.name, archive.name);
  15. });
  16. });
  17. });