uploadgateway.js 919 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. 'use strict';
  6. import FileUploader from '../../src/uploadgateway/fileuploader';
  7. import UploadGateway from '../../src/uploadgateway/uploadgateway';
  8. describe( 'UploadGateway', () => {
  9. describe( 'constructor()', () => {
  10. it( 'should throw error when no token provided', () => {
  11. expect( () => new UploadGateway( undefined, 'test' ) ).to.throw( 'Token must be provided' );
  12. } );
  13. it( 'should throw error when no apiAddress provided', () => {
  14. expect( () => new UploadGateway( 'token' ) ).to.throw( 'Api address must be provided' );
  15. } );
  16. } );
  17. describe( 'upload()', () => {
  18. it( 'should return `FileUploader` instance', () => {
  19. const uploader = new UploadGateway( 'token', 'test' );
  20. expect( uploader.upload( 'file' ) ).to.be.instanceOf( FileUploader );
  21. } );
  22. } );
  23. } );