-
Notifications
You must be signed in to change notification settings - Fork 445
/
Copy pathapp.component.spec.ts
77 lines (68 loc) · 2.11 KB
/
app.component.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// angular
import { TestBed } from '@angular/core/testing';
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { Route } from '@angular/router';
import { RouterTestingModule } from '@angular/router/testing';
// libs
import { StoreModule } from '@ngrx/store';
import { Angulartics2Module, Angulartics2Segment } from 'angulartics2';
// app
import { t } from '../modules/test/index';
import { Config } from '../modules/core/index';
import { TEST_CORE_PROVIDERS, TEST_HTTP_PROVIDERS } from '../modules/core/testing/index';
import { NameListService } from '../modules/sample/index';
import { SharedModule } from '../modules/shared/index';
import { MultilingualModule } from '../modules/i18n/multilingual.module';
import { reducer, LanguageProviders } from '../modules/i18n/index';
// module
import { APP_COMPONENTS } from './index';
import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component';
const config:Route[] = [
{path: '', component: HomeComponent},
{path: 'about', component: AboutComponent}
];
// test module configuration for each test
const testModuleConfig = () => {
TestBed.configureTestingModule({
imports: [
SharedModule,
Angulartics2Module.forRoot([
Angulartics2Segment
]),
MultilingualModule,
StoreModule.provideStore({ }),
RouterTestingModule.withRoutes(config)
],
declarations: [
TestComponent,
...APP_COMPONENTS
],
providers: [
TEST_CORE_PROVIDERS(),
TEST_HTTP_PROVIDERS(),
NameListService,
LanguageProviders
]
});
};
export function main() {
t.describe('@Component: AppComponent', () => {
t.be(testModuleConfig);
t.it('should build without a problem',
t.async(() => {
TestBed.compileComponents()
.then(() => {
let fixture = TestBed.createComponent(TestComponent);
fixture.detectChanges();
t.e(fixture.nativeElement).toBeTruthy();
});
}));
});
}
@Component({
selector: 'test-cmp',
template: '<sd-app></sd-app>'
})
class TestComponent {}