Commit 825c7191 authored by Jérémy Destin's avatar Jérémy Destin
Browse files

fix: Fix the fronted test and the errors and warning of the linter. GNP-4309

parent fe275ed5
......@@ -34,7 +34,7 @@ describe('ErrorInterceptorService', () => {
error = err;
});
httpClient.get('/test').subscribe(null, noop);
httpClient.get('/test').subscribe({ next: null, error: noop });
http.expectOne('/test').error(new ErrorEvent('unknown', { message: 'not good' }));
expect(error.status).toBeNull();
......@@ -47,7 +47,7 @@ describe('ErrorInterceptorService', () => {
error = err;
});
httpClient.get('/test').subscribe(null, noop);
httpClient.get('/test').subscribe({ next: null, error: noop });
http.expectOne('/test').flush(null, { status: 500, statusText: 'Server Error' });
expect(error.status).toBe(500);
......@@ -68,7 +68,7 @@ describe('ErrorInterceptorService', () => {
}
};
httpClient.get('/test').subscribe(null, noop);
httpClient.get('/test').subscribe({ next: null, error: noop });
http.expectOne('/test').flush(result, { status: 500, statusText: 'Server Error' });
expect(error.status).toBe(500);
......@@ -91,7 +91,7 @@ describe('ErrorInterceptorService', () => {
}
};
httpClient.get('/test').subscribe(null, noop);
httpClient.get('/test').subscribe({ next: null, error: noop });
http.expectOne('/test').flush(result, { status: 500, statusText: 'Server Error' });
expect(error.status).toBe(500);
......
import { Injectable } from '@angular/core';
import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
import {
HttpErrorResponse,
HttpEvent,
HttpHandler,
HttpInterceptor,
HttpRequest
} from '@angular/common/http';
import { Observable, Subject } from 'rxjs';
import { tap } from 'rxjs/operators';
......@@ -17,7 +23,7 @@ export class ErrorInterceptorService implements HttpInterceptor {
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(req).pipe(
tap(null, err => this.errorSubject.next(this.toError(err)))
tap(() => null, err => this.errorSubject.next(this.toError(err)))
);
}
......
......@@ -22,11 +22,11 @@ describe('LargeFacetsComponent', () => {
}
get facetTitle() {
return this.element('h3')
return this.element('h3');
}
get facetInput() {
return this.element('input')
return this.element('input');
}
}
......@@ -45,7 +45,7 @@ describe('LargeFacetsComponent', () => {
term: 'Germplasm',
label: 'GERMPLASM',
count: 10
},{
}, {
term: 'Traditional cultivar/landrace',
label: 'Traditional cultivar/landrace',
count: 74
......@@ -57,7 +57,7 @@ describe('LargeFacetsComponent', () => {
term: 'Hybrid',
label: 'Hybrid',
count: 478
},{
}, {
term: 'INRA',
label: 'INRA',
count: 74
......@@ -104,7 +104,7 @@ describe('LargeFacetsComponent', () => {
it ('should display search box', () => {
const tester = new LargeFacetsComponentTester();
const component = tester.componentInstance;
component = tester.componentInstance;
component.facet = largeFacet;
tester.detectChanges();
......
......@@ -11,6 +11,7 @@ import {
import { BehaviorSubject } from 'rxjs';
import { take } from 'rxjs/operators';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { GermplasmSearchCriteria } from '../../models/gnpis.model';
describe('SmallFacetsComponent', () => {
class FacetsComponentTester extends ComponentTester<SmallFacetsComponent> {
......@@ -76,6 +77,8 @@ describe('SmallFacetsComponent', () => {
const component = tester.componentInstance;
component.facet = exampleFacet1;
component.criteria$ = new BehaviorSubject<DataDiscoveryCriteria>(DataDiscoveryCriteriaUtils.emptyCriteria());
component.germplasmSearchCriteria$ = new BehaviorSubject<GermplasmSearchCriteria>(DataDiscoveryCriteriaUtils
.emptyGermplasmSearchCriteria());
component.displayGermplasmResult$ = new BehaviorSubject<boolean>(false);
tester.detectChanges();
......@@ -116,6 +119,8 @@ describe('SmallFacetsComponent', () => {
const component = tester.componentInstance;
component.facet = exampleFacet1;
component.criteria$ = new BehaviorSubject<DataDiscoveryCriteria>(DataDiscoveryCriteriaUtils.emptyCriteria());
component.germplasmSearchCriteria$ = new BehaviorSubject<GermplasmSearchCriteria>(DataDiscoveryCriteriaUtils
.emptyGermplasmSearchCriteria());
component.displayGermplasmResult$ = new BehaviorSubject<boolean>(false);
tester.detectChanges();
......@@ -162,6 +167,8 @@ describe('SmallFacetsComponent', () => {
types: ['Germplasm', 'Phenotyping Study']
};
component.criteria$ = new BehaviorSubject<DataDiscoveryCriteria>(DataDiscoveryCriteriaUtils.emptyCriteria());
component.germplasmSearchCriteria$ = new BehaviorSubject<GermplasmSearchCriteria>(DataDiscoveryCriteriaUtils
.emptyGermplasmSearchCriteria());
component.displayGermplasmResult$ = new BehaviorSubject<boolean>(false);
component.facet = exampleFacet2;
tester.detectChanges();
......
Supports Markdown
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