mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
#272 Update 'upload' test config
This commit is contained in:
@@ -52,6 +52,21 @@ System.config(config);
|
||||
|
||||
System.import('@angular/platform-browser/src/browser/browser_adapter')
|
||||
.then(function(browser_adapter) { browser_adapter.BrowserDomAdapter.makeCurrent(); })
|
||||
.then(function () {
|
||||
return Promise.all([
|
||||
System.import('@angular/core/testing'),
|
||||
System.import('@angular/platform-browser-dynamic/testing')
|
||||
])
|
||||
})
|
||||
.then(function (providers) {
|
||||
var testing = providers[0];
|
||||
var testingBrowser = providers[1];
|
||||
|
||||
testing.setBaseTestProviders(
|
||||
testingBrowser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
|
||||
testingBrowser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
|
||||
|
||||
})
|
||||
.then(function() { return Promise.all(resolveTestFiles()); })
|
||||
.then(
|
||||
function() {
|
||||
|
@@ -15,13 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { describe, expect, it, inject, beforeEachProviders, setBaseTestProviders } from '@angular/core/testing';
|
||||
import { describe, expect, it, inject, beforeEachProviders } from '@angular/core/testing';
|
||||
import { TestComponentBuilder } from '@angular/compiler/testing';
|
||||
import {
|
||||
TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
|
||||
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
import { provide } from '@angular/core';
|
||||
import { FileUploadingDialogComponent } from './file-uploading-dialog.component';
|
||||
import { FileModel } from '../models/file.model';
|
||||
import { AlfrescoTranslationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||
@@ -32,13 +27,11 @@ import { Observable } from 'rxjs/Observable';
|
||||
|
||||
describe('FileUploadDialog', () => {
|
||||
|
||||
setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
|
||||
|
||||
beforeEachProviders(() => {
|
||||
return [
|
||||
provide(AlfrescoSettingsService, {useClass: AlfrescoSettingsService}),
|
||||
provide(AlfrescoTranslationService, {useClass: TranslationMock}),
|
||||
provide(UploadService, {useClass: UploadServiceMock})
|
||||
{ provide: AlfrescoSettingsService, useClass: AlfrescoSettingsService },
|
||||
{ provide: AlfrescoTranslationService, useClass: TranslationMock },
|
||||
{ provide: UploadService, useClass: UploadServiceMock }
|
||||
];
|
||||
});
|
||||
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { describe, expect, it, inject, beforeEachProviders } from '@angular/core/testing';
|
||||
import { TestComponentBuilder } from '@angular/compiler/testing';
|
||||
import { provide } from '@angular/core';
|
||||
import { UploadButtonComponent } from './upload-button.component';
|
||||
import { AlfrescoTranslationService, AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||
import { TranslationMock } from '../assets/translation.service.mock';
|
||||
@@ -37,9 +36,9 @@ describe('AlfrescoUploadButton', () => {
|
||||
|
||||
beforeEachProviders(() => {
|
||||
return [
|
||||
provide(AlfrescoSettingsService, {useClass: AlfrescoSettingsService}),
|
||||
provide(AlfrescoTranslationService, {useClass: TranslationMock}),
|
||||
provide(UploadService, {useClass: UploadServiceMock})
|
||||
{ provide: AlfrescoSettingsService },
|
||||
{ provide: AlfrescoTranslationService, useClass: TranslationMock },
|
||||
{ provide: UploadService, useClass: UploadServiceMock }
|
||||
];
|
||||
});
|
||||
|
||||
|
@@ -17,15 +17,12 @@
|
||||
|
||||
import { it, describe, inject, beforeEach, beforeEachProviders } from '@angular/core/testing';
|
||||
import { UploadService } from './upload.service';
|
||||
import { provide } from '@angular/core';
|
||||
import { FileModel } from './../models/file.model';
|
||||
import { AlfrescoSettingsService } from 'ng2-alfresco-core';
|
||||
import { AlfrescoSettingsServiceMock } from '../assets/AlfrescoSettingsService.service.mock';
|
||||
import { AlfrescoApiMock } from '../assets/AlfrescoApi.mock';
|
||||
|
||||
|
||||
declare var AlfrescoApi: any;
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
let doneFn = jasmine.createSpy('success');
|
||||
@@ -66,10 +63,12 @@ describe('AlfrescoUploadService', () => {
|
||||
|
||||
window['AlfrescoApi'] = AlfrescoApiMock;
|
||||
|
||||
beforeEachProviders(() => [
|
||||
provide(AlfrescoSettingsService, {useClass: AlfrescoSettingsServiceMock}),
|
||||
provide(UploadService, {useClass: MockUploadService})
|
||||
]);
|
||||
beforeEachProviders(() => {
|
||||
return [
|
||||
{ provide: AlfrescoSettingsService, useClass: AlfrescoSettingsServiceMock },
|
||||
{ provide: UploadService, useClass: MockUploadService }
|
||||
];
|
||||
});
|
||||
|
||||
beforeEach( inject([UploadService], (uploadService: UploadService) => {
|
||||
jasmine.Ajax.install();
|
||||
|
Reference in New Issue
Block a user