Test runner improvements

- now all tests are running
This commit is contained in:
Denys Vuika
2016-06-23 13:41:58 +01:00
committed by Will Abson
parent 58a21ea4ad
commit 1296087170
4 changed files with 51 additions and 27 deletions

View File

@@ -54,6 +54,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() {

View File

@@ -16,11 +16,7 @@
*/
import { provide } from '@angular/core';
import {
TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
} from '@angular/platform-browser-dynamic/testing';
import { it, describe, expect, inject, beforeEachProviders, setBaseTestProviders } from '@angular/core/testing';
import { it, describe, expect, inject, beforeEachProviders } from '@angular/core/testing';
import { TestComponentBuilder } from '@angular/compiler/testing';
import { AlfrescoSearchAutocompleteComponent } from './alfresco-search-autocomplete.component';
import { SearchServiceMock } from './../assets/alfresco-search.service.mock';
@@ -35,8 +31,6 @@ describe('AlfrescoSearchAutocompleteComponent', () => {
let searchService;
setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
beforeEachProviders(() => {
searchService = new SearchServiceMock();

View File

@@ -15,17 +15,35 @@
* limitations under the License.
*/
import {
TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
} from '@angular/platform-browser-dynamic/testing';
import { it, describe, expect, inject, setBaseTestProviders } from '@angular/core/testing';
import { provide } from '@angular/core';
import { it, describe, expect, inject, beforeEachProviders } from '@angular/core/testing';
import { TestComponentBuilder } from '@angular/compiler/testing';
import { AlfrescoSearchControlComponent } from './alfresco-search-control.component';
import { SearchServiceMock } from './../assets/alfresco-search.service.mock';
import { AlfrescoThumbnailService } from './../services/alfresco-thumbnail.service';
import { TranslationMock } from './../assets/translation.service.mock';
import {
AlfrescoSettingsService,
AlfrescoAuthenticationService,
AlfrescoContentService,
AlfrescoTranslationService } from 'ng2-alfresco-core';
describe('AlfrescoSearchControlComponent', () => {
setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
let searchService;
beforeEachProviders(() => {
searchService = new SearchServiceMock();
return [
searchService.getProviders(),
provide(AlfrescoThumbnailService, {}),
provide(AlfrescoTranslationService, {useClass: TranslationMock}),
provide(AlfrescoSettingsService, {}),
provide(AlfrescoAuthenticationService, {}),
provide(AlfrescoContentService, {})
];
});
it('should setup i18n folder', () => {
@@ -40,7 +58,9 @@ describe('AlfrescoSearchControlComponent', () => {
it('should emit searchChange when search term changed',
inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
return tcb.createAsync(AlfrescoSearchControlComponent).then((componentFixture) => {
return tcb
.createAsync(AlfrescoSearchControlComponent)
.then((componentFixture) => {
componentFixture.componentInstance.searchTerm = 'customSearchTerm';
componentFixture.detectChanges();
componentFixture.componentInstance.searchChange.subscribe(e => {

View File

@@ -16,16 +16,13 @@
*/
import { provide } from '@angular/core';
import {
TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS
} from '@angular/platform-browser-dynamic/testing';
import { it, describe, expect, inject, beforeEachProviders, setBaseTestProviders } from '@angular/core/testing';
import { it, describe, expect, inject, beforeEachProviders } from '@angular/core/testing';
import { TestComponentBuilder } from '@angular/compiler/testing';
import { RouteParams } from '@angular/router-deprecated';
import { AlfrescoSearchComponent } from './alfresco-search.component';
import { SearchServiceMock } from './../assets/alfresco-search.service.mock';
import { AlfrescoThumbnailService } from './../services/alfresco-thumbnail.service';
import { TranslationMock } from './../assets/translation.service.mock';
import {
AlfrescoSettingsService,
AlfrescoAuthenticationService,
@@ -36,15 +33,13 @@ describe('AlfrescoSearchComponent', () => {
let searchService;
setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
beforeEachProviders(() => {
searchService = new SearchServiceMock();
return [
searchService.getProviders(),
provide(AlfrescoThumbnailService, {}),
provide(AlfrescoTranslationService, {}),
provide(AlfrescoTranslationService, {useClass: TranslationMock}),
provide(AlfrescoSettingsService, {}),
provide(AlfrescoAuthenticationService, {}),
provide(AlfrescoContentService, {})