Skip to content

Commit c119a96

Browse files
committed
[NAE-1711] Dashboard
- corrected tests
1 parent af8867b commit c119a96

File tree

1 file changed

+132
-120
lines changed

1 file changed

+132
-120
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,132 @@
1-
// import { ComponentFixture, TestBed } from '@angular/core/testing';
2-
// import { FilterFieldTabbedCaseViewComponent } from './filter-field-tabbed-case-view.component';
3-
// import { HttpClientTestingModule } from '@angular/common/http/testing';
4-
// import {
5-
// AllowedNetsService,
6-
// AllowedNetsServiceFactory,
7-
// AuthenticationMethodService,
8-
// CaseHeaderService,
9-
// ConfigurationService, createMockNet, MaterialModule, MockAuthenticationMethodService, MockUserService,
10-
// NAE_BASE_FILTER, NAE_TAB_DATA, ProcessService,
11-
// SearchService, SimpleFilter,
12-
// TestConfigurationService, TestNoAllowedNetsFactory, TranslateLibModule, User, UserService,
13-
// TestMockDependenciesModule,
14-
// AbstractHeaderService,
15-
// UserPreferenceService,
16-
// MockUserPreferenceService
17-
// } from '@netgrif/components-core';
18-
// import { MatSnackBarModule } from '@angular/material/snack-bar';
19-
// import { RouterTestingModule } from '@angular/router/testing';
20-
// import { NoopAnimationsModule } from '@angular/platform-browser/animations';
21-
// import { Component, Injectable } from '@angular/core';
22-
// import { of } from 'rxjs';
23-
// import { NavigationComponentModule } from '../../navigation/navigation.module';
24-
//
25-
// describe('FilterFieldTabbedCaseViewComponent', () => {
26-
// let component: FilterFieldTabbedCaseViewComponent;
27-
// let fixture: ComponentFixture<TestWrapperComponent>;
28-
//
29-
// beforeEach(async () => {
30-
// await TestBed.configureTestingModule({
31-
// declarations: [ TestWrapperComponent, FilterFieldTabbedCaseViewComponent ],
32-
// imports: [
33-
// HttpClientTestingModule,
34-
// MatSnackBarModule,
35-
// RouterTestingModule.withRoutes([]),
36-
// MaterialModule,
37-
// NoopAnimationsModule,
38-
// TranslateLibModule,
39-
// NavigationComponentModule,
40-
// TestMockDependenciesModule
41-
// ],
42-
// providers: [
43-
// {provide: AuthenticationMethodService, useClass: MockAuthenticationMethodService},
44-
// {provide: UserService, useClass: CustomMockUserService},
45-
// {provide: ConfigurationService, useClass: TestConfigurationService},
46-
// SearchService,
47-
// {provide: NAE_BASE_FILTER, useValue: {filter: SimpleFilter.emptyCaseFilter()}},
48-
// {
49-
// provide: AllowedNetsService,
50-
// useFactory: TestNoAllowedNetsFactory,
51-
// deps: [AllowedNetsServiceFactory]
52-
// },
53-
// {
54-
// provide: ProcessService,
55-
// useClass: MockProcessService
56-
// },
57-
// {provide: NAE_TAB_DATA, useValue: {tabViewComponent: undefined, tabViewOrder: 1}},
58-
// {provide: UserPreferenceService, useClass: MockUserPreferenceService},
59-
// {provide: AbstractHeaderService, useClass: CaseHeaderService},
60-
// ]
61-
// })
62-
// .compileComponents();
63-
// });
64-
//
65-
// beforeEach(() => {
66-
// fixture = TestBed.createComponent(TestWrapperComponent);
67-
// component = fixture.debugElement.componentInstance.el;
68-
// fixture.detectChanges();
69-
// });
70-
//
71-
// it('should create', () => {
72-
// expect(component).toBeTruthy();
73-
// });
74-
// });
75-
//
76-
// @Component({
77-
// selector: 'nc-test-wrapper',
78-
// template: '<nc-filter-field-tabbed-case-view></nc-filter-field-tabbed-case-view>'
79-
// })
80-
// class TestWrapperComponent {
81-
// constructor() {
82-
// }
83-
//
84-
// }
85-
//
86-
// @Injectable()
87-
// class CustomMockUserService extends MockUserService {
88-
// constructor() {
89-
// super();
90-
// this._user = new User('123', 'test@netgrif.com', 'Test', 'User', ['ROLE_USER'], [{
91-
// stringId: 'id',
92-
// name: 'id',
93-
// description: '',
94-
// importId: 'id',
95-
// netImportId: 'identifier',
96-
// netVersion: '1.0.0',
97-
// netStringId: 'stringId',
98-
// }]);
99-
// }
100-
// }
101-
//
102-
// @Injectable()
103-
// class MockProcessService {
104-
//
105-
// public getNets() {
106-
// return of([createMockNet(
107-
// 'stringId',
108-
// 'identifier',
109-
// 'title',
110-
// [{
111-
// stringId: 'id',
112-
// name: 'id'
113-
// }], [], [], {
114-
// id: {
115-
// create: true
116-
// }
117-
// }
118-
// )]);
119-
// }
120-
// }
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { FilterFieldTabbedCaseViewComponent } from './filter-field-tabbed-case-view.component';
3+
import { HttpClientTestingModule } from '@angular/common/http/testing';
4+
import {
5+
AllowedNetsService,
6+
AllowedNetsServiceFactory,
7+
AuthenticationMethodService,
8+
CaseHeaderService,
9+
ConfigurationService, createMockNet, MaterialModule, MockAuthenticationMethodService, MockUserService,
10+
NAE_BASE_FILTER, NAE_TAB_DATA, ProcessService,
11+
SearchService, SimpleFilter,
12+
TestConfigurationService, TestNoAllowedNetsFactory, TranslateLibModule, User, UserService,
13+
TestMockDependenciesModule,
14+
AbstractHeaderService,
15+
UserPreferenceService,
16+
MockUserPreferenceService,
17+
OverflowService,
18+
AuthenticationService,
19+
UserResourceService,
20+
MockAuthenticationService,
21+
MockUserResourceService,
22+
CaseViewService,
23+
ViewService,
24+
TestViewService,
25+
NAE_VIEW_ID_SEGMENT
26+
} from '@netgrif/components-core';
27+
import { MatSnackBarModule } from '@angular/material/snack-bar';
28+
import { RouterTestingModule } from '@angular/router/testing';
29+
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
30+
import { Component, Injectable } from '@angular/core';
31+
import { of } from 'rxjs';
32+
import { NavigationComponentModule } from '../../navigation/navigation.module';
33+
import { HeaderComponent } from '../../header/header.component';
34+
35+
describe('FilterFieldTabbedCaseViewComponent', () => {
36+
let component: FilterFieldTabbedCaseViewComponent;
37+
let fixture: ComponentFixture<TestWrapperComponent>;
38+
39+
beforeEach(async () => {
40+
await TestBed.configureTestingModule({
41+
declarations: [ TestWrapperComponent, FilterFieldTabbedCaseViewComponent, HeaderComponent],
42+
imports: [
43+
HttpClientTestingModule,
44+
MatSnackBarModule,
45+
RouterTestingModule.withRoutes([]),
46+
MaterialModule,
47+
NoopAnimationsModule,
48+
TranslateLibModule,
49+
NavigationComponentModule,
50+
TestMockDependenciesModule
51+
],
52+
providers: [
53+
{provide: NAE_VIEW_ID_SEGMENT, useValue: 'id'},
54+
{provide: AuthenticationMethodService, useClass: MockAuthenticationMethodService},
55+
{provide: UserService, useClass: CustomMockUserService},
56+
SearchService,
57+
{provide: NAE_BASE_FILTER, useValue: {filter: SimpleFilter.emptyCaseFilter()}},
58+
{
59+
provide: ProcessService,
60+
useClass: MockProcessService
61+
},
62+
{provide: NAE_TAB_DATA, useValue: {tabViewComponent: undefined, tabViewOrder: 1}},
63+
{provide: AuthenticationService, useClass: MockAuthenticationService},
64+
{provide: UserResourceService, useClass: MockUserResourceService},
65+
{provide: ConfigurationService, useClass: TestConfigurationService},
66+
{provide: CaseViewService, useValue: {allowedNets$: of([])}},
67+
{provide: ViewService, useClass: TestViewService},
68+
{provide: AllowedNetsService, useFactory: TestNoAllowedNetsFactory, deps: [AllowedNetsServiceFactory]},
69+
OverflowService,
70+
{provide: UserPreferenceService, useClass: MockUserPreferenceService},
71+
{provide: AbstractHeaderService, useClass: CaseHeaderService},
72+
]
73+
})
74+
.compileComponents();
75+
});
76+
77+
beforeEach(() => {
78+
fixture = TestBed.createComponent(TestWrapperComponent);
79+
component = fixture.debugElement.children[0].componentInstance;
80+
fixture.detectChanges();
81+
});
82+
83+
it('should create', () => {
84+
expect(component).toBeTruthy();
85+
});
86+
});
87+
88+
@Component({
89+
selector: 'nc-test-wrapper',
90+
template: '<nc-filter-field-tabbed-case-view></nc-filter-field-tabbed-case-view>'
91+
})
92+
class TestWrapperComponent {
93+
constructor() {
94+
}
95+
96+
}
97+
98+
@Injectable()
99+
class CustomMockUserService extends MockUserService {
100+
constructor() {
101+
super();
102+
this._user = new User('123', 'test@netgrif.com', 'Test', 'User', ['ROLE_USER'], [{
103+
stringId: 'id',
104+
name: 'id',
105+
description: '',
106+
importId: 'id',
107+
netImportId: 'identifier',
108+
netVersion: '1.0.0',
109+
netStringId: 'stringId',
110+
}]);
111+
}
112+
}
113+
114+
@Injectable()
115+
class MockProcessService {
116+
117+
public getNets() {
118+
return of([createMockNet(
119+
'stringId',
120+
'identifier',
121+
'title',
122+
[{
123+
stringId: 'id',
124+
name: 'id'
125+
}], [], [], {
126+
id: {
127+
create: true
128+
}
129+
}
130+
)]);
131+
}
132+
}

0 commit comments

Comments
 (0)