diff --git a/ng2-components/ng2-alfresco-upload/package.json b/ng2-components/ng2-alfresco-upload/package.json index efd609c78d..cff25c8146 100644 --- a/ng2-components/ng2-alfresco-upload/package.json +++ b/ng2-components/ng2-alfresco-upload/package.json @@ -9,7 +9,7 @@ "tsc": "tsc", "tsc:w": "tsc -w", "typings": "typings", - "test": "live-server --open=tests-runner.html" + "test": "live-server --open=index.html --entry-file=test/ " }, "repository": { "type": "git", diff --git a/ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.d.ts b/ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.d.ts deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.js b/ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.js deleted file mode 100644 index f0dc027e4b..0000000000 --- a/ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @license - * Copyright 2016 Alfresco Software, Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -System.register(['angular2/testing', 'angular2/core', 'angular2/http', 'angular2/http/testing', './upload.service'], function(exports_1, context_1) { - "use strict"; - var __moduleName = context_1 && context_1.id; - var testing_1, core_1, http_1, testing_2, upload_service_1; - return { - setters:[ - function (testing_1_1) { - testing_1 = testing_1_1; - }, - function (core_1_1) { - core_1 = core_1_1; - }, - function (http_1_1) { - http_1 = http_1_1; - }, - function (testing_2_1) { - testing_2 = testing_2_1; - }, - function (upload_service_1_1) { - upload_service_1 = upload_service_1_1; - }], - execute: function() { - testing_1.describe('AlfrescoUploadService', function () { - var injector, backend, mockBackend, httpService, service, options; - beforeEach(function () { - injector = core_1.Injector.resolveAndCreate([ - http_1.HTTP_PROVIDERS, - testing_2.MockBackend, - core_1.provide(http_1.XHRBackend, { useClass: testing_2.MockBackend }) - ]); - mockBackend = injector.get(testing_2.MockBackend); - backend = injector.get(http_1.XHRBackend); - httpService = injector.get(http_1.Http); - options = { - url: '', - withCredentials: true, - authToken: btoa('fakeadmin:fakeadmin'), - authTokenPrefix: 'Basic', - fieldName: 'fakeFileData', - formFields: { - siteid: 'fakeSite', - containerid: 'fakeFolder' - } - }; - service = new upload_service_1.UploadService(options); - }); - testing_1.it('should make XHR request', function () { - var xhr = { - open: jasmine.createSpy('open'), - upload: jasmine.createSpy('upload'), - send: jasmine.createSpy('send'), - setRequestHeader: jasmine.createSpy('setRequestHeader') - }; - XMLHttpRequest = jasmine.createSpy('XMLHttpRequest'); - XMLHttpRequest.and.callFake(function () { - return xhr; - }); - var filesFake = [{ name: 'fake-name', size: 10 }]; - service.addToQueue(filesFake); - expect(xhr.open).toHaveBeenCalled(); - }); - }); - } - } -}); -//# sourceMappingURL=upload.service.spec.js.map \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.js.map b/ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.js.map deleted file mode 100644 index f9c6f0dd4e..0000000000 --- a/ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"upload.service.spec.js","sourceRoot":"","sources":["upload.service.spec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;YAQH,kBAAQ,CAAC,uBAAuB,EAAE;gBAC9B,IAAI,QAAQ,EACR,OAAO,EACP,WAAW,EACX,WAAW,EACX,OAAO,EACP,OAAO,CAAC;gBAEZ,UAAU,CAAC;oBACP,QAAQ,GAAG,eAAQ,CAAC,gBAAgB,CAAC;wBACjC,qBAAc;wBACd,qBAAW;wBACX,cAAO,CAAC,iBAAU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CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;gBACxC,CAAC,CAAC,CAAC;YAIP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-upload/test/.gitignore b/ng2-components/ng2-alfresco-upload/test/.gitignore new file mode 100644 index 0000000000..75871e6dc2 --- /dev/null +++ b/ng2-components/ng2-alfresco-upload/test/.gitignore @@ -0,0 +1,3 @@ +*.js +*.js.map +*.d.ts diff --git a/ng2-components/ng2-alfresco-upload/test/index.html b/ng2-components/ng2-alfresco-upload/test/index.html new file mode 100644 index 0000000000..c6030e01cb --- /dev/null +++ b/ng2-components/ng2-alfresco-upload/test/index.html @@ -0,0 +1,54 @@ + + + + + + Alfresco Upload component Tests + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.ts b/ng2-components/ng2-alfresco-upload/test/services/upload.service.spec.ts similarity index 88% rename from ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.ts rename to ng2-components/ng2-alfresco-upload/test/services/upload.service.spec.ts index 439cb9d708..8fb588b12f 100644 --- a/ng2-components/ng2-alfresco-upload/src/services/upload.service.spec.ts +++ b/ng2-components/ng2-alfresco-upload/test/services/upload.service.spec.ts @@ -15,11 +15,11 @@ * limitations under the License. */ -import {it, describe} from 'angular2/testing'; +import {it, describe, beforeEach, expect} from 'angular2/testing'; import {provide, Injector} from 'angular2/core'; -import {Http, HTTP_PROVIDERS, XHRBackend, Response, ResponseOptions} from 'angular2/http'; +import {Http, HTTP_PROVIDERS, XHRBackend} from 'angular2/http'; import {MockBackend} from 'angular2/http/testing'; -import {UploadService} from './upload.service'; +import {UploadService} from '../../src/services/upload.service'; describe('AlfrescoUploadService', () => { let injector, @@ -56,11 +56,12 @@ describe('AlfrescoUploadService', () => { it('should make XHR request', () => { - var xhr = { + let xhr = { open: jasmine.createSpy('open'), upload: jasmine.createSpy('upload'), send: jasmine.createSpy('send'), - setRequestHeader: jasmine.createSpy('setRequestHeader') + setRequestHeader: jasmine.createSpy('setRequestHeader'), + onprogress : jasmine.createSpy('onprogress') }; XMLHttpRequest = jasmine.createSpy('XMLHttpRequest'); @@ -76,4 +77,4 @@ describe('AlfrescoUploadService', () => { -}); \ No newline at end of file +}); diff --git a/ng2-components/ng2-alfresco-upload/test/tsconfig.json b/ng2-components/ng2-alfresco-upload/test/tsconfig.json new file mode 100644 index 0000000000..9f1af2fc60 --- /dev/null +++ b/ng2-components/ng2-alfresco-upload/test/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "system", + "moduleResolution": "node", + "sourceMap": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "removeComments": false, + "noImplicitAny": false, + "declaration": false + }, + "exclude": [ + ] +} diff --git a/ng2-components/ng2-alfresco-upload/tests-runner.html b/ng2-components/ng2-alfresco-upload/tests-runner.html deleted file mode 100644 index 1748b9bae1..0000000000 --- a/ng2-components/ng2-alfresco-upload/tests-runner.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - Alfresco Login component Tests - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file