| 1234567891011121314151617181920212223242526272829303132 |
- /**
- * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
- * For licensing, see LICENSE.md.
- */
- 'use strict';
- import FileUploader from '../../src/uploadgateway/fileuploader';
- import UploadGateway from '../../src/uploadgateway/uploadgateway';
- import Token from '../../src/token/token';
- describe( 'UploadGateway', () => {
- const token = new Token( 'url', { initTokenValue: 'token', autoRefresh: false } );
- describe( 'constructor()', () => {
- it( 'should throw error when no token provided', () => {
- expect( () => new UploadGateway( undefined, 'test' ) ).to.throw( 'Token must be provided' );
- } );
- it( 'should throw error when no apiAddress provided', () => {
- expect( () => new UploadGateway( token ) ).to.throw( 'Api address must be provided' );
- } );
- } );
- describe( 'upload()', () => {
- it( 'should return `FileUploader` instance', () => {
- const uploader = new UploadGateway( token, 'test' );
- expect( uploader.upload( 'file' ) ).to.be.instanceOf( FileUploader );
- } );
- } );
- } );
|