Skip to content
Snippets Groups Projects
Commit 432b23db authored by oussamasic's avatar oussamasic
Browse files

correct logbook operation tests

parent 23bd42a6
No related branches found
No related tags found
1 merge request!51Merge mis a jour vitam-ui
...@@ -35,16 +35,14 @@ ...@@ -35,16 +35,14 @@
* knowledge of the CeCILL-C license and that you accept its terms. * knowledge of the CeCILL-C license and that you accept its terms.
*/ */
import { ENVIRONMENT, GlobalEventService, InjectorModule, LoggerModule } from 'ui-frontend-common';
import { NO_ERRORS_SCHEMA } from '@angular/core'; import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ReactiveFormsModule } from '@angular/forms'; import { ReactiveFormsModule } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { MatMenuModule } from '@angular/material/menu'; import { MatMenuModule } from '@angular/material/menu';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { EMPTY, of } from 'rxjs'; import { EMPTY, of } from 'rxjs';
import { ENVIRONMENT, GlobalEventService, InjectorModule, LoggerModule, SearchBarComponent, SearchBarModule } from 'ui-frontend-common';
import { environment } from '../../environments/environment'; import { environment } from '../../environments/environment';
import { LogbookOperationComponent } from './logbook-operation.component'; import { LogbookOperationComponent } from './logbook-operation.component';
import { LogbookSearchService } from './logbook-search.service'; import { LogbookSearchService } from './logbook-search.service';
...@@ -53,29 +51,25 @@ describe('LogbookOperationComponent', () => { ...@@ -53,29 +51,25 @@ describe('LogbookOperationComponent', () => {
let component: LogbookOperationComponent; let component: LogbookOperationComponent;
let fixture: ComponentFixture<LogbookOperationComponent>; let fixture: ComponentFixture<LogbookOperationComponent>;
beforeEach(waitForAsync(() => { beforeEach(
const matDialogSpy = jasmine.createSpyObj('MatDialog', ['open']); waitForAsync(() => {
matDialogSpy.open.and.returnValue({ afterClosed: () => of(true) }); const matDialogSpy = jasmine.createSpyObj('MatDialog', ['open']);
TestBed.configureTestingModule({ matDialogSpy.open.and.returnValue({ afterClosed: () => of(true) });
imports: [ TestBed.configureTestingModule({
MatMenuModule, imports: [MatMenuModule, ReactiveFormsModule, InjectorModule, LoggerModule.forRoot(), SearchBarModule],
ReactiveFormsModule, declarations: [LogbookOperationComponent, SearchBarComponent],
InjectorModule, providers: [
LoggerModule.forRoot() { provide: MatDialog, useValue: matDialogSpy },
], { provide: ActivatedRoute, useValue: { paramMap: EMPTY, data: EMPTY, queryParams: of({ guid: 'ID' }) } },
declarations: [LogbookOperationComponent], { provide: LogbookSearchService, useValue: { search: () => EMPTY } },
providers: [ { provide: Router, useValue: { navigate: () => {} } },
{ provide: MatDialog, useValue: matDialogSpy }, GlobalEventService,
{ provide: ActivatedRoute, useValue: { paramMap: EMPTY, data: EMPTY } }, { provide: ENVIRONMENT, useValue: environment },
{ provide: LogbookSearchService, useValue: { search: () => EMPTY } }, ],
{ provide: Router, useValue: { navigate: () => { } } }, schemas: [NO_ERRORS_SCHEMA],
GlobalEventService, }).compileComponents();
{ provide: ENVIRONMENT, useValue: environment }
],
schemas: [NO_ERRORS_SCHEMA]
}) })
.compileComponents(); );
}));
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(LogbookOperationComponent); fixture = TestBed.createComponent(LogbookOperationComponent);
......
...@@ -45,7 +45,7 @@ import { LogbookOperationListComponent } from './logbook-operation-list/logbook- ...@@ -45,7 +45,7 @@ import { LogbookOperationListComponent } from './logbook-operation-list/logbook-
@Component({ @Component({
selector: 'app-logbook-operation', selector: 'app-logbook-operation',
templateUrl: './logbook-operation.component.html', templateUrl: './logbook-operation.component.html',
styleUrls: ['./logbook-operation.component.scss'] styleUrls: ['./logbook-operation.component.scss'],
}) })
export class LogbookOperationComponent extends SidenavPage<any> implements OnInit { export class LogbookOperationComponent extends SidenavPage<any> implements OnInit {
search = ''; search = '';
...@@ -70,14 +70,14 @@ export class LogbookOperationComponent extends SidenavPage<any> implements OnIni ...@@ -70,14 +70,14 @@ export class LogbookOperationComponent extends SidenavPage<any> implements OnIni
this.dateRangeFilterForm = this.formBuilder.group({ this.dateRangeFilterForm = this.formBuilder.group({
startDate: null, startDate: null,
endDate: null endDate: null,
}); });
this.dateRangeFilterForm.valueChanges.subscribe((value) => { this.dateRangeFilterForm.valueChanges.subscribe((value) => {
this.filters = { this.filters = {
type: this.filters.type, type: this.filters.type,
status: this.filters.status, status: this.filters.status,
dateRange: value dateRange: value,
}; };
}); });
} }
......
...@@ -34,37 +34,33 @@ ...@@ -34,37 +34,33 @@
* The fact that you are presently reading this means that you have had * The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms. * knowledge of the CeCILL-C license and that you accept its terms.
*/ */
import {TableFilterModule, VitamUICommonModule} from 'ui-frontend-common'; import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import {CommonModule} from '@angular/common'; import { ReactiveFormsModule } from '@angular/forms';
import {NgModule} from '@angular/core'; import { MatNativeDateModule } from '@angular/material/core';
import {ReactiveFormsModule} from '@angular/forms'; import { MatDatepickerModule } from '@angular/material/datepicker';
import {MatDialogModule} from '@angular/material/dialog'; import { MatDialogModule } from '@angular/material/dialog';
import {MatNativeDateModule} from '@angular/material/core'; import { MatMenuModule } from '@angular/material/menu';
import {MatDatepickerModule} from '@angular/material/datepicker'; import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import {MatMenuModule} from '@angular/material/menu'; import { MatSelectModule } from '@angular/material/select';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner'; import { MatSidenavModule } from '@angular/material/sidenav';
import {MatSidenavModule} from '@angular/material/sidenav'; import { MatSnackBarModule } from '@angular/material/snack-bar';
import {MatTabsModule} from '@angular/material/tabs'; import { MatTabsModule } from '@angular/material/tabs';
import {MatSnackBarModule} from '@angular/material/snack-bar'; import { MatTooltipModule } from '@angular/material/tooltip';
import {MatSelectModule} from '@angular/material/select'; import { TableFilterModule, VitamUICommonModule } from 'ui-frontend-common';
import { LogbookOperationDetailComponent } from './logbook-operation-detail/logbook-operation-detail.component';
import { import { LogbookOperationPopupComponent } from './logbook-operation-detail/logbook-operation-popup.component';
LogbookOperationDetailComponent import { EventTypeBadgeClassPipe } from './logbook-operation-list/event-type-badge-class.pipe';
} from './logbook-operation-detail/logbook-operation-detail.component'; import { EventTypeColorClassPipe } from './logbook-operation-list/event-type-color-class.pipe';
import { import { LastEventPipe } from './logbook-operation-list/last-event.pipe';
LogbookOperationPopupComponent import { LogbookOperationListComponent } from './logbook-operation-list/logbook-operation-list.component';
} from './logbook-operation-detail/logbook-operation-popup.component'; import { LogbookOperationRoutingModule } from './logbook-operation-routing.module';
import {EventTypeBadgeClassPipe} from './logbook-operation-list/event-type-badge-class.pipe'; import { LogbookOperationComponent } from './logbook-operation.component';
import {EventTypeColorClassPipe} from './logbook-operation-list/event-type-color-class.pipe';
import {LastEventPipe} from './logbook-operation-list/last-event.pipe';
import {LogbookOperationListComponent} from './logbook-operation-list/logbook-operation-list.component';
import {LogbookOperationRoutingModule} from './logbook-operation-routing.module';
import {LogbookOperationComponent} from './logbook-operation.component';
@NgModule({ @NgModule({
declarations: [ declarations: [
LogbookOperationComponent, LogbookOperationComponent,
LogbookOperationListComponent, LogbookOperationListComponent,
LogbookOperationDetailComponent, LogbookOperationDetailComponent,
LogbookOperationPopupComponent, LogbookOperationPopupComponent,
...@@ -86,7 +82,8 @@ import {LogbookOperationComponent} from './logbook-operation.component'; ...@@ -86,7 +82,8 @@ import {LogbookOperationComponent} from './logbook-operation.component';
LogbookOperationRoutingModule, LogbookOperationRoutingModule,
MatNativeDateModule, MatNativeDateModule,
MatSelectModule, MatSelectModule,
TableFilterModule TableFilterModule,
] MatTooltipModule,
],
}) })
export class LogbookOperationModule { } export class LogbookOperationModule {}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment