You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by lp...@apache.org on 2017/09/12 10:04:45 UTC

[28/57] [abbrv] ambari git commit: AMBARI-21915 Log Search UI: unit tests setup. (ababiichuk)

AMBARI-21915 Log Search UI: unit tests setup. (ababiichuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/2ab8b39c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2ab8b39c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2ab8b39c

Branch: refs/heads/feature-branch-AMBARI-21307
Commit: 2ab8b39c17da02d4c06b22d12b9fa041c7407540
Parents: a059478
Author: ababiichuk <ab...@hortonworks.com>
Authored: Fri Sep 8 14:44:20 2017 +0300
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Fri Sep 8 14:44:20 2017 +0300

----------------------------------------------------------------------
 .../ambari-logsearch-web/.angular-cli.json      |    2 +-
 .../ambari-logsearch-web/karma.conf.js          |   10 +-
 .../ambari-logsearch-web/package.json           |    4 +-
 .../src/app/components/app.component.spec.ts    |   14 +-
 .../dropdown-button.component.spec.ts           |   14 +-
 .../dropdown-list.component.spec.ts             |   14 +-
 .../filter-button.component.spec.ts             |   15 +-
 .../filter-dropdown.component.spec.ts           |   14 +-
 .../filters-panel.component.spec.ts             |   14 +-
 .../login-form/login-form.component.spec.ts     |   15 +-
 .../logs-list/logs-list.component.spec.ts       |   14 +-
 .../menu-button/menu-button.component.spec.ts   |   18 +-
 .../components/modal/modal.component.spec.ts    |   16 +-
 .../pagination/pagination.component.spec.ts     |   29 +-
 .../search-box/search-box.component.spec.ts     |   16 +-
 .../timezone-picker.component.spec.ts           |   14 +-
 .../app/services/http-client.service.spec.ts    |    8 +-
 .../src/app/test-config.spec.ts                 |   36 +
 .../ambari-logsearch-web/src/test.ts            |    7 +-
 ambari-logsearch/ambari-logsearch-web/yarn.lock | 1803 +++++++++++++-----
 20 files changed, 1409 insertions(+), 668 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/.angular-cli.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/.angular-cli.json b/ambari-logsearch/ambari-logsearch-web/.angular-cli.json
index cc74739..70fd7b6 100644
--- a/ambari-logsearch/ambari-logsearch-web/.angular-cli.json
+++ b/ambari-logsearch/ambari-logsearch-web/.angular-cli.json
@@ -1,7 +1,7 @@
 {
   "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
   "project": {
-    "name": "ambari-logsearch-web-new"
+    "name": "ambari-logsearch-web"
   },
   "apps": [
     {

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/karma.conf.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/karma.conf.js b/ambari-logsearch/ambari-logsearch-web/karma.conf.js
index 0512808..08608d8 100644
--- a/ambari-logsearch/ambari-logsearch-web/karma.conf.js
+++ b/ambari-logsearch/ambari-logsearch-web/karma.conf.js
@@ -25,7 +25,7 @@ module.exports = function (config) {
     frameworks: ['jasmine', '@angular/cli'],
     plugins: [
       require('karma-jasmine'),
-      require('karma-chrome-launcher'),
+      require('karma-phantomjs-launcher'),
       require('karma-jasmine-html-reporter'),
       require('karma-coverage-istanbul-reporter'),
       require('@angular/cli/plugins/karma')
@@ -43,7 +43,7 @@ module.exports = function (config) {
       'text/x-typescript': ['ts','tsx']
     },
     coverageIstanbulReporter: {
-      reports: [ 'html', 'lcovonly' ],
+      reports: ['html', 'lcovonly'],
       fixWebpackSourcePaths: true
     },
     angularCli: {
@@ -55,8 +55,8 @@ module.exports = function (config) {
     port: 9876,
     colors: true,
     logLevel: config.LOG_INFO,
-    autoWatch: true,
-    browsers: ['Chrome'],
-    singleRun: false
+    autoWatch: false,
+    browsers: ['PhantomJS'],
+    singleRun: true
   });
 };

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/package.json
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/package.json b/ambari-logsearch/ambari-logsearch-web/package.json
index 92c5043..0892d85 100644
--- a/ambari-logsearch/ambari-logsearch-web/package.json
+++ b/ambari-logsearch/ambari-logsearch-web/package.json
@@ -39,7 +39,7 @@
     "zone.js": "^0.8.4"
   },
   "devDependencies": {
-    "@angular/cli": "1.0.0",
+    "@angular/cli": "^1.4.0",
     "@angular/compiler-cli": "^4.0.0",
     "@types/d3": "^4.10.0",
     "@types/jasmine": "2.5.38",
@@ -52,11 +52,11 @@
     "jasmine-core": "~2.5.2",
     "jasmine-spec-reporter": "~3.2.0",
     "karma": "~1.4.1",
-    "karma-chrome-launcher": "~2.0.0",
     "karma-cli": "~1.0.1",
     "karma-coverage-istanbul-reporter": "^0.2.0",
     "karma-jasmine": "~1.1.0",
     "karma-jasmine-html-reporter": "^0.2.2",
+    "karma-phantomjs-launcher": "^1.0.4",
     "protractor": "~5.1.0",
     "ts-node": "~2.0.0",
     "tslint": "~4.5.0",

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.spec.ts
index bc16ea4..490e058 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/app.component.spec.ts
@@ -18,19 +18,13 @@
 
 import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
 import {TestBed, async} from '@angular/core/testing';
-import {Http} from '@angular/http';
-import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
 import {StoreModule} from '@ngrx/store';
+import {TranslationModules} from '@app/test-config.spec';
 import {AppStateService, appState} from '@app/services/storage/app-state.service';
 import {HttpClientService} from '@app/services/http-client.service';
 
 import {AppComponent} from './app.component';
 
-export function HttpLoaderFactory(http: Http) {
-  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
-}
-
 describe('AppComponent', () => {
   beforeEach(async(() => {
     const httpClient = {
@@ -46,11 +40,7 @@ describe('AppComponent', () => {
         StoreModule.provideStore({
           appState
         }),
-        TranslateModule.forRoot({
-          provide: TranslateLoader,
-          useFactory: HttpLoaderFactory,
-          deps: [Http]
-        })
+        ...TranslationModules
       ],
       providers: [
         AppStateService,

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
index 8efe320..c5845b3 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-button/dropdown-button.component.spec.ts
@@ -18,9 +18,7 @@
 
 import {NO_ERRORS_SCHEMA} from '@angular/core';
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {Http} from '@angular/http';
-import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+import {TranslationModules} from '@app/test-config.spec';
 import {StoreModule} from '@ngrx/store';
 import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
 import {ClustersService, clusters} from '@app/services/storage/clusters.service';
@@ -31,10 +29,6 @@ import {ComponentActionsService} from '@app/services/component-actions.service';
 
 import {DropdownButtonComponent} from './dropdown-button.component';
 
-export function HttpLoaderFactory(http: Http) {
-  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
-}
-
 describe('DropdownButtonComponent', () => {
   let component: DropdownButtonComponent;
   let fixture: ComponentFixture<DropdownButtonComponent>;
@@ -48,11 +42,7 @@ describe('DropdownButtonComponent', () => {
           clusters,
           components
         }),
-        TranslateModule.forRoot({
-          provide: TranslateLoader,
-          useFactory: HttpLoaderFactory,
-          deps: [Http]
-        })
+        ...TranslationModules
       ],
       providers: [
         AppSettingsService,

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts
index 5409d30..eacac04 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/dropdown-list/dropdown-list.component.spec.ts
@@ -17,10 +17,8 @@
  */
 
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {Http} from '@angular/http';
-import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
 import {StoreModule} from '@ngrx/store';
+import {TranslationModules} from '@app/test-config.spec';
 import {HostsService, hosts} from '@app/services/storage/hosts.service';
 import {AuditLogsService, auditLogs} from '@app/services/storage/audit-logs.service';
 import {ServiceLogsService, serviceLogs} from '@app/services/storage/service-logs.service';
@@ -37,10 +35,6 @@ import {FilteringService} from '@app/services/filtering.service';
 
 import {DropdownListComponent} from './dropdown-list.component';
 
-export function HttpLoaderFactory(http: Http) {
-  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
-}
-
 describe('DropdownListComponent', () => {
   let component: DropdownListComponent;
   let fixture: ComponentFixture<DropdownListComponent>;
@@ -57,11 +51,7 @@ describe('DropdownListComponent', () => {
     TestBed.configureTestingModule({
       declarations: [DropdownListComponent],
       imports: [
-        TranslateModule.forRoot({
-          provide: TranslateLoader,
-          useFactory: HttpLoaderFactory,
-          deps: [Http]
-        }),
+        ...TranslationModules,
         StoreModule.provideStore({
           hosts,
           auditLogs,

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
index 5d58b5c..22e4fca 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-button/filter-button.component.spec.ts
@@ -18,9 +18,7 @@
 
 import {NO_ERRORS_SCHEMA} from '@angular/core';
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {Http} from '@angular/http';
-import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+import {TranslationModules} from '@app/test-config.spec';
 import {StoreModule} from '@ngrx/store';
 import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
 import {ClustersService, clusters} from '@app/services/storage/clusters.service';
@@ -31,10 +29,6 @@ import {UtilsService} from '@app/services/utils.service';
 
 import {FilterButtonComponent} from './filter-button.component';
 
-export function HttpLoaderFactory(http: Http) {
-  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
-}
-
 describe('FilterButtonComponent', () => {
   let component: FilterButtonComponent;
   let fixture: ComponentFixture<FilterButtonComponent>;
@@ -48,11 +42,8 @@ describe('FilterButtonComponent', () => {
           clusters,
           components
         }),
-        TranslateModule.forRoot({
-          provide: TranslateLoader,
-          useFactory: HttpLoaderFactory,
-          deps: [Http]
-        })],
+        ...TranslationModules
+      ],
       providers: [
         AppSettingsService,
         ClustersService,

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
index 323aa56..8620607 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filter-dropdown/filter-dropdown.component.spec.ts
@@ -17,9 +17,7 @@
 
 import {NO_ERRORS_SCHEMA} from '@angular/core';
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {Http} from '@angular/http';
-import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+import {TranslationModules} from '@app/test-config.spec';
 import {StoreModule} from '@ngrx/store';
 import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
 import {FilteringService} from '@app/services/filtering.service';
@@ -28,10 +26,6 @@ import {ComponentActionsService} from '@app/services/component-actions.service';
 
 import {FilterDropdownComponent} from './filter-dropdown.component';
 
-export function HttpLoaderFactory(http: Http) {
-  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
-}
-
 describe('FilterDropdownComponent', () => {
   let component: FilterDropdownComponent;
   let fixture: ComponentFixture<FilterDropdownComponent>;
@@ -59,11 +53,7 @@ describe('FilterDropdownComponent', () => {
         StoreModule.provideStore({
           appSettings
         }),
-        TranslateModule.forRoot({
-          provide: TranslateLoader,
-          useFactory: HttpLoaderFactory,
-          deps: [Http]
-        })
+        ...TranslationModules
       ],
       providers: [
         AppSettingsService,

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.spec.ts
index 2ced41e..fe2e40a 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/filters-panel/filters-panel.component.spec.ts
@@ -18,9 +18,7 @@
 
 import {NO_ERRORS_SCHEMA} from '@angular/core';
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {Http} from '@angular/http';
-import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+import {TranslationModules} from '@app/test-config.spec';
 import {StoreModule} from '@ngrx/store';
 import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
 import {ClustersService, clusters} from '@app/services/storage/clusters.service';
@@ -39,10 +37,6 @@ import {LogsContainerService} from '@app/services/logs-container.service';
 
 import {FiltersPanelComponent} from './filters-panel.component';
 
-export function HttpLoaderFactory(http: Http) {
-  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
-}
-
 describe('FiltersPanelComponent', () => {
   let component: FiltersPanelComponent;
   let fixture: ComponentFixture<FiltersPanelComponent>;
@@ -71,11 +65,7 @@ describe('FiltersPanelComponent', () => {
           serviceLogsHistogramData,
           appState
         }),
-        TranslateModule.forRoot({
-          provide: TranslateLoader,
-          useFactory: HttpLoaderFactory,
-          deps: [Http]
-        })
+        ...TranslationModules
       ],
       providers: [
         AppSettingsService,

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.spec.ts
index fd54fe6..fb5c2a0 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/login-form/login-form.component.spec.ts
@@ -18,19 +18,13 @@
 
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
 import {FormsModule} from '@angular/forms';
-import {HttpModule, Http} from '@angular/http';
-import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+import {TranslationModules} from '@app/test-config.spec';
 import {StoreModule} from '@ngrx/store';
 import {AppStateService, appState} from '@app/services/storage/app-state.service';
 import {HttpClientService} from '@app/services/http-client.service';
 
 import {LoginFormComponent} from './login-form.component';
 
-export function HttpLoaderFactory(http: Http) {
-  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
-}
-
 describe('LoginFormComponent', () => {
   let component: LoginFormComponent;
   let fixture: ComponentFixture<LoginFormComponent>;
@@ -53,13 +47,8 @@ describe('LoginFormComponent', () => {
     TestBed.configureTestingModule({
       declarations: [LoginFormComponent],
       imports: [
-        HttpModule,
         FormsModule,
-        TranslateModule.forRoot({
-          provide: TranslateLoader,
-          useFactory: HttpLoaderFactory,
-          deps: [Http]
-        }),
+        ...TranslationModules,
         StoreModule.provideStore({
           appState
         })

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.spec.ts
index 02c3b23..8c67a13 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/logs-list/logs-list.component.spec.ts
@@ -17,9 +17,7 @@
 
 import {NO_ERRORS_SCHEMA} from '@angular/core';
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {Http} from '@angular/http';
-import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+import {TranslationModules} from '@app/test-config.spec';
 import {StoreModule} from '@ngrx/store';
 import {MomentModule} from 'angular2-moment';
 import {MomentTimezoneModule} from 'angular-moment-timezone';
@@ -35,10 +33,6 @@ import {UtilsService} from '@app/services/utils.service';
 
 import {LogsListComponent} from './logs-list.component';
 
-export function HttpLoaderFactory(http: Http) {
-  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
-}
-
 describe('LogsListComponent', () => {
   let component: LogsListComponent;
   let fixture: ComponentFixture<LogsListComponent>;
@@ -65,11 +59,7 @@ describe('LogsListComponent', () => {
         }),
         MomentModule,
         MomentTimezoneModule,
-        TranslateModule.forRoot({
-          provide: TranslateLoader,
-          useFactory: HttpLoaderFactory,
-          deps: [Http]
-        })
+        ...TranslationModules
       ],
       providers: [
         {

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
index 6c9e021..c57c11d 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/menu-button/menu-button.component.spec.ts
@@ -18,9 +18,7 @@
 
 import {NO_ERRORS_SCHEMA} from '@angular/core';
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {Http} from '@angular/http';
-import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+import {TranslationModules} from '@app/test-config.spec';
 import {StoreModule} from '@ngrx/store';
 import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
 import {ComponentActionsService} from '@app/services/component-actions.service';
@@ -28,10 +26,6 @@ import {FilteringService} from '@app/services/filtering.service';
 
 import {MenuButtonComponent} from './menu-button.component';
 
-export function HttpLoaderFactory(http: Http) {
-  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
-}
-
 describe('MenuButtonComponent', () => {
   let component: MenuButtonComponent;
   let fixture: ComponentFixture<MenuButtonComponent>;
@@ -43,11 +37,7 @@ describe('MenuButtonComponent', () => {
         StoreModule.provideStore({
           appSettings
         }),
-        TranslateModule.forRoot({
-          provide: TranslateLoader,
-          useFactory: HttpLoaderFactory,
-          deps: [Http]
-        })
+        ...TranslationModules
       ],
       providers: [
         AppSettingsService,
@@ -100,11 +90,13 @@ describe('MenuButtonComponent', () => {
     const cases = [
       {
         subItems: null,
+        hideCaret: false,
         hasCaret: false,
         title: 'no sub-items'
       },
       {
         subItems: [],
+        hideCaret: false,
         hasCaret: false,
         title: 'empty sub-items array'
       },
@@ -125,7 +117,7 @@ describe('MenuButtonComponent', () => {
     cases.forEach((test) => {
       it(test.title, () => {
         component.subItems = test.subItems;
-        component.hideCaret = Boolean(test.hideCaret);
+        component.hideCaret = test.hideCaret;
         expect(component.hasSubItems).toEqual(test.hasCaret);
       });
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/components/modal/modal.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/modal/modal.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/modal/modal.component.spec.ts
index 802bd13..acdcae8 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/modal/modal.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/modal/modal.component.spec.ts
@@ -17,16 +17,10 @@
  */
 
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {Http} from '@angular/http';
-import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+import {TranslationModules} from '@app/test-config.spec';
 
 import {ModalComponent} from './modal.component';
 
-export function HttpLoaderFactory(http: Http) {
-  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
-}
-
 describe('ModalComponent', () => {
   let component: ModalComponent;
   let fixture: ComponentFixture<ModalComponent>;
@@ -34,13 +28,7 @@ describe('ModalComponent', () => {
   beforeEach(async(() => {
     TestBed.configureTestingModule({
       declarations: [ModalComponent],
-      imports: [
-        TranslateModule.forRoot({
-          provide: TranslateLoader,
-          useFactory: HttpLoaderFactory,
-          deps: [Http]
-        })
-      ]
+      imports: TranslationModules
     })
     .compileComponents();
   }));

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.spec.ts
index 7a15bbc..ff8675d 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/pagination/pagination.component.spec.ts
@@ -18,29 +18,18 @@
 
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
 import {NO_ERRORS_SCHEMA} from '@angular/core';
-import {Http} from '@angular/http';
-import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+import {TranslationModules} from '@app/test-config.spec';
+import {FormControl, FormGroup} from '@angular/forms';
 
 import {PaginationComponent} from './pagination.component';
 
-export function HttpLoaderFactory(http: Http) {
-  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
-}
-
 describe('PaginationComponent', () => {
   let component: PaginationComponent;
   let fixture: ComponentFixture<PaginationComponent>;
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      imports: [
-        TranslateModule.forRoot({
-          provide: TranslateLoader,
-          useFactory: HttpLoaderFactory,
-          deps: [Http]
-        })
-      ],
+      imports: TranslationModules,
       declarations: [PaginationComponent],
       schemas: [NO_ERRORS_SCHEMA]
     })
@@ -51,15 +40,9 @@ describe('PaginationComponent', () => {
     fixture = TestBed.createComponent(PaginationComponent);
     component = fixture.componentInstance;
     component.filterInstance = {};
-    component.filtersForm = {
-      controls: {
-        pageSize: {
-          valueChanges: {
-            subscribe: () => {}
-          }
-        }
-      }
-    };
+    component.filtersForm = new FormGroup({
+      pageSize: new FormControl()
+    });
     fixture.detectChanges();
   });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
index 2b3a957..72795a4 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/search-box/search-box.component.spec.ts
@@ -18,17 +18,11 @@
 
 import {NO_ERRORS_SCHEMA} from '@angular/core';
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {Http} from '@angular/http';
-import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+import {TranslationModules} from '@app/test-config.spec';
 import {UtilsService} from '@app/services/utils.service';
 
 import {SearchBoxComponent} from './search-box.component';
 
-export function HttpLoaderFactory(http: Http) {
-  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
-}
-
 describe('SearchBoxComponent', () => {
   let component: SearchBoxComponent;
   let fixture: ComponentFixture<SearchBoxComponent>;
@@ -36,13 +30,7 @@ describe('SearchBoxComponent', () => {
   beforeEach(async(() => {
     TestBed.configureTestingModule({
       declarations: [SearchBoxComponent],
-      imports: [
-        TranslateModule.forRoot({
-          provide: TranslateLoader,
-          useFactory: HttpLoaderFactory,
-          deps: [Http]
-        })
-      ],
+      imports: TranslationModules,
       providers: [
         UtilsService
       ],

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
index 0ef17de..380f030 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/components/timezone-picker/timezone-picker.component.spec.ts
@@ -17,9 +17,7 @@
  */
 
 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
-import {Http} from '@angular/http';
-import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
-import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+import {TranslationModules} from '@app/test-config.spec';
 import {StoreModule} from '@ngrx/store';
 import {AppSettingsService, appSettings} from '@app/services/storage/app-settings.service';
 import {ComponentActionsService} from '@app/services/component-actions.service';
@@ -28,10 +26,6 @@ import {ModalComponent} from '@app/components/modal/modal.component';
 
 import {TimeZonePickerComponent} from './timezone-picker.component';
 
-export function HttpLoaderFactory(http: Http) {
-  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
-}
-
 describe('TimeZonePickerComponent', () => {
   let component: TimeZonePickerComponent;
   let fixture: ComponentFixture<TimeZonePickerComponent>;
@@ -47,11 +41,7 @@ describe('TimeZonePickerComponent', () => {
         StoreModule.provideStore({
           appSettings
         }),
-        TranslateModule.forRoot({
-          provide: TranslateLoader,
-          useFactory: HttpLoaderFactory,
-          deps: [Http]
-        })
+        ...TranslationModules
       ],
       providers: [
         AppSettingsService,

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.spec.ts
index 0dfb0f3..4720a74 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.spec.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/services/http-client.service.spec.ts
@@ -44,24 +44,24 @@ describe('HttpClientService', () => {
 
   describe('#generateUrlString()', () => {
     it('should generate URL from presets', inject([HttpClientService], (service: HttpClientService) => {
-      expect(service.generateUrlString('status')).toEqual('api/v1/status');
+      expect(service['generateUrlString']('status')).toEqual('api/v1/status');
     }));
 
     it('should return explicit URL', inject([HttpClientService], (service: HttpClientService) => {
-      expect(service.generateUrlString('login')).toEqual('login');
+      expect(service['generateUrlString']('login')).toEqual('login');
     }));
   });
 
   describe('#generateUrl()', () => {
     it('string parameter', inject([HttpClientService], (service: HttpClientService) => {
-      expect(service.generateUrl('status')).toEqual('api/v1/status');
+      expect(service['generateUrl']('status')).toEqual('api/v1/status');
     }));
 
     it('request object parameter', inject([HttpClientService], (service: HttpClientService) => {
       let request = new Request({
         url: 'status'
       });
-      expect(service.generateUrl(request).url).toEqual('api/v1/status');
+      expect(service['generateUrl'](request)['url']).toEqual('api/v1/status');
     }));
   });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/app/test-config.spec.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/app/test-config.spec.ts b/ambari-logsearch/ambari-logsearch-web/src/app/test-config.spec.ts
new file mode 100644
index 0000000..8fc6c87
--- /dev/null
+++ b/ambari-logsearch/ambari-logsearch-web/src/app/test-config.spec.ts
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import {HttpModule, Http} from '@angular/http';
+import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
+import {TranslateHttpLoader} from '@ngx-translate/http-loader';
+
+function HttpLoaderFactory(http: Http) {
+  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
+}
+
+export const TranslationModules = [
+  HttpModule,
+  TranslateModule.forRoot({
+    loader: {
+      provide: TranslateLoader,
+      useFactory: HttpLoaderFactory,
+      deps: [Http]
+    }
+  })
+];

http://git-wip-us.apache.org/repos/asf/ambari/blob/2ab8b39c/ambari-logsearch/ambari-logsearch-web/src/test.ts
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-web/src/test.ts b/ambari-logsearch/ambari-logsearch-web/src/test.ts
index 6597b1c..0fc13fb 100644
--- a/ambari-logsearch/ambari-logsearch-web/src/test.ts
+++ b/ambari-logsearch/ambari-logsearch-web/src/test.ts
@@ -24,11 +24,8 @@ import 'zone.js/dist/sync-test';
 import 'zone.js/dist/jasmine-patch';
 import 'zone.js/dist/async-test';
 import 'zone.js/dist/fake-async-test';
-import { getTestBed } from '@angular/core/testing';
-import {
-  BrowserDynamicTestingModule,
-  platformBrowserDynamicTesting
-} from '@angular/platform-browser-dynamic/testing';
+import {getTestBed} from '@angular/core/testing';
+import {BrowserDynamicTestingModule, platformBrowserDynamicTesting} from '@angular/platform-browser-dynamic/testing';
 
 // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
 declare var __karma__: any;