mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
120243: Fix lint issues after upgrade
This commit is contained in:

committed by
Yury Bondarenko

parent
ae32581d20
commit
d87b375a35
@@ -1,3 +1,7 @@
|
|||||||
|
import {
|
||||||
|
provideHttpClient,
|
||||||
|
withInterceptorsFromDi,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
@@ -20,7 +24,6 @@ import { RawRestResponse } from 'src/app/core/dspace-rest/raw-rest-response.mode
|
|||||||
import { TranslateLoaderMock } from 'src/app/shared/mocks/translate-loader.mock';
|
import { TranslateLoaderMock } from 'src/app/shared/mocks/translate-loader.mock';
|
||||||
|
|
||||||
import { FilteredCollectionsComponent } from './filtered-collections.component';
|
import { FilteredCollectionsComponent } from './filtered-collections.component';
|
||||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
||||||
|
|
||||||
describe('FiltersComponent', () => {
|
describe('FiltersComponent', () => {
|
||||||
let component: FilteredCollectionsComponent;
|
let component: FilteredCollectionsComponent;
|
||||||
@@ -40,22 +43,22 @@ describe('FiltersComponent', () => {
|
|||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
imports: [NgbAccordionModule,
|
imports: [NgbAccordionModule,
|
||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: TranslateLoaderMock,
|
useClass: TranslateLoaderMock,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
FilteredCollectionsComponent],
|
FilteredCollectionsComponent],
|
||||||
providers: [
|
providers: [
|
||||||
FormBuilder,
|
FormBuilder,
|
||||||
DspaceRestService,
|
DspaceRestService,
|
||||||
provideHttpClient(withInterceptorsFromDi()),
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
provideHttpClientTesting(),
|
provideHttpClientTesting(),
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(waitForAsync(() => {
|
beforeEach(waitForAsync(() => {
|
||||||
|
@@ -1,5 +1,12 @@
|
|||||||
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
import {
|
||||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
HTTP_INTERCEPTORS,
|
||||||
|
provideHttpClient,
|
||||||
|
withInterceptorsFromDi,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import {
|
||||||
|
HttpTestingController,
|
||||||
|
provideHttpClientTesting,
|
||||||
|
} from '@angular/common/http/testing';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
@@ -25,21 +32,21 @@ describe(`AuthInterceptor`, () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [],
|
imports: [],
|
||||||
providers: [
|
providers: [
|
||||||
DspaceRestService,
|
DspaceRestService,
|
||||||
{ provide: AuthService, useValue: authServiceStub },
|
{ provide: AuthService, useValue: authServiceStub },
|
||||||
{ provide: Router, useClass: RouterStub },
|
{ provide: Router, useClass: RouterStub },
|
||||||
{
|
{
|
||||||
provide: HTTP_INTERCEPTORS,
|
provide: HTTP_INTERCEPTORS,
|
||||||
useClass: AuthInterceptor,
|
useClass: AuthInterceptor,
|
||||||
multi: true,
|
multi: true,
|
||||||
},
|
},
|
||||||
{ provide: Store, useValue: store },
|
{ provide: Store, useValue: store },
|
||||||
provideHttpClient(withInterceptorsFromDi()),
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
provideHttpClientTesting(),
|
provideHttpClientTesting(),
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
service = TestBed.inject(DspaceRestService);
|
service = TestBed.inject(DspaceRestService);
|
||||||
httpMock = TestBed.inject(HttpTestingController);
|
httpMock = TestBed.inject(HttpTestingController);
|
||||||
|
@@ -1,4 +1,13 @@
|
|||||||
import { HttpErrorResponse, HttpEvent, HttpHandler, HttpHeaders, HttpInterceptor, HttpRequest, HttpResponse, HttpResponseBase } from '@angular/common/http';
|
import {
|
||||||
|
HttpErrorResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpHandler,
|
||||||
|
HttpHeaders,
|
||||||
|
HttpInterceptor,
|
||||||
|
HttpRequest,
|
||||||
|
HttpResponse,
|
||||||
|
HttpResponseBase,
|
||||||
|
} from '@angular/common/http';
|
||||||
import {
|
import {
|
||||||
Injectable,
|
Injectable,
|
||||||
Injector,
|
Injector,
|
||||||
|
@@ -1,4 +1,8 @@
|
|||||||
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
|
import {
|
||||||
|
HttpClient,
|
||||||
|
HttpHeaders,
|
||||||
|
HttpResponse,
|
||||||
|
} from '@angular/common/http';
|
||||||
import {
|
import {
|
||||||
Observable,
|
Observable,
|
||||||
of as observableOf,
|
of as observableOf,
|
||||||
|
@@ -1,4 +1,8 @@
|
|||||||
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
|
import {
|
||||||
|
HttpClient,
|
||||||
|
HttpHeaders,
|
||||||
|
HttpResponse,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
import { HttpHeaders, HttpParams } from '@angular/common/http';
|
import {
|
||||||
|
HttpHeaders,
|
||||||
|
HttpParams,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
|
@@ -1,4 +1,8 @@
|
|||||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
import {
|
||||||
|
HttpClient,
|
||||||
|
HttpHeaders,
|
||||||
|
HttpParams,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
@@ -1,5 +1,13 @@
|
|||||||
import { HttpErrorResponse, HttpHeaders, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
import {
|
||||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
HttpErrorResponse,
|
||||||
|
HttpHeaders,
|
||||||
|
provideHttpClient,
|
||||||
|
withInterceptorsFromDi,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import {
|
||||||
|
HttpTestingController,
|
||||||
|
provideHttpClientTesting,
|
||||||
|
} from '@angular/common/http/testing';
|
||||||
import {
|
import {
|
||||||
inject,
|
inject,
|
||||||
TestBed,
|
TestBed,
|
||||||
@@ -27,9 +35,13 @@ describe('DspaceRestService', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [],
|
imports: [],
|
||||||
providers: [DspaceRestService, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
|
providers: [
|
||||||
});
|
DspaceRestService,
|
||||||
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
|
provideHttpClientTesting(),
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
dspaceRestService = TestBed.inject(DspaceRestService);
|
dspaceRestService = TestBed.inject(DspaceRestService);
|
||||||
httpMock = TestBed.inject(HttpTestingController);
|
httpMock = TestBed.inject(HttpTestingController);
|
||||||
|
@@ -1,4 +1,10 @@
|
|||||||
import { HttpClient, HttpErrorResponse, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
|
import {
|
||||||
|
HttpClient,
|
||||||
|
HttpErrorResponse,
|
||||||
|
HttpHeaders,
|
||||||
|
HttpParams,
|
||||||
|
HttpResponse,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
Observable,
|
Observable,
|
||||||
|
@@ -1,5 +1,12 @@
|
|||||||
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
import {
|
||||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
HTTP_INTERCEPTORS,
|
||||||
|
provideHttpClient,
|
||||||
|
withInterceptorsFromDi,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import {
|
||||||
|
HttpTestingController,
|
||||||
|
provideHttpClientTesting,
|
||||||
|
} from '@angular/common/http/testing';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { REQUEST } from '../../../express.tokens';
|
import { REQUEST } from '../../../express.tokens';
|
||||||
@@ -18,19 +25,19 @@ describe('ForwardClientIpInterceptor', () => {
|
|||||||
clientIp = '1.2.3.4';
|
clientIp = '1.2.3.4';
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [],
|
imports: [],
|
||||||
providers: [
|
providers: [
|
||||||
DspaceRestService,
|
DspaceRestService,
|
||||||
{
|
{
|
||||||
provide: HTTP_INTERCEPTORS,
|
provide: HTTP_INTERCEPTORS,
|
||||||
useClass: ForwardClientIpInterceptor,
|
useClass: ForwardClientIpInterceptor,
|
||||||
multi: true,
|
multi: true,
|
||||||
},
|
},
|
||||||
{ provide: REQUEST, useValue: { get: () => undefined, connection: { remoteAddress: clientIp } } },
|
{ provide: REQUEST, useValue: { get: () => undefined, connection: { remoteAddress: clientIp } } },
|
||||||
provideHttpClient(withInterceptorsFromDi()),
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
provideHttpClientTesting(),
|
provideHttpClientTesting(),
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
service = TestBed.inject(DspaceRestService);
|
service = TestBed.inject(DspaceRestService);
|
||||||
httpMock = TestBed.inject(HttpTestingController);
|
httpMock = TestBed.inject(HttpTestingController);
|
||||||
|
@@ -1,4 +1,9 @@
|
|||||||
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
import {
|
||||||
|
HttpEvent,
|
||||||
|
HttpHandler,
|
||||||
|
HttpInterceptor,
|
||||||
|
HttpRequest,
|
||||||
|
} from '@angular/common/http';
|
||||||
import {
|
import {
|
||||||
Inject,
|
Inject,
|
||||||
Injectable,
|
Injectable,
|
||||||
|
@@ -1,5 +1,12 @@
|
|||||||
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
import {
|
||||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
HTTP_INTERCEPTORS,
|
||||||
|
provideHttpClient,
|
||||||
|
withInterceptorsFromDi,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import {
|
||||||
|
HttpTestingController,
|
||||||
|
provideHttpClientTesting,
|
||||||
|
} from '@angular/common/http/testing';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
|
|
||||||
@@ -22,19 +29,19 @@ describe(`LocaleInterceptor`, () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [],
|
imports: [],
|
||||||
providers: [
|
providers: [
|
||||||
DspaceRestService,
|
DspaceRestService,
|
||||||
{
|
{
|
||||||
provide: HTTP_INTERCEPTORS,
|
provide: HTTP_INTERCEPTORS,
|
||||||
useClass: LocaleInterceptor,
|
useClass: LocaleInterceptor,
|
||||||
multi: true,
|
multi: true,
|
||||||
},
|
},
|
||||||
{ provide: LocaleService, useValue: mockLocaleService },
|
{ provide: LocaleService, useValue: mockLocaleService },
|
||||||
provideHttpClient(withInterceptorsFromDi()),
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
provideHttpClientTesting(),
|
provideHttpClientTesting(),
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
service = TestBed.inject(DspaceRestService);
|
service = TestBed.inject(DspaceRestService);
|
||||||
httpMock = TestBed.inject(HttpTestingController);
|
httpMock = TestBed.inject(HttpTestingController);
|
||||||
|
@@ -1,4 +1,9 @@
|
|||||||
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
import {
|
||||||
|
HttpEvent,
|
||||||
|
HttpHandler,
|
||||||
|
HttpInterceptor,
|
||||||
|
HttpRequest,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
|
@@ -1,5 +1,12 @@
|
|||||||
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
import {
|
||||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
HTTP_INTERCEPTORS,
|
||||||
|
provideHttpClient,
|
||||||
|
withInterceptorsFromDi,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import {
|
||||||
|
HttpTestingController,
|
||||||
|
provideHttpClientTesting,
|
||||||
|
} from '@angular/common/http/testing';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { StoreModule } from '@ngrx/store';
|
import { StoreModule } from '@ngrx/store';
|
||||||
@@ -36,14 +43,14 @@ describe('LogInterceptor', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [StoreModule.forRoot(appReducers, storeModuleConfig)],
|
imports: [StoreModule.forRoot(appReducers, storeModuleConfig)],
|
||||||
providers: [
|
providers: [
|
||||||
DspaceRestService,
|
DspaceRestService,
|
||||||
// LogInterceptor,
|
// LogInterceptor,
|
||||||
{
|
{
|
||||||
provide: HTTP_INTERCEPTORS,
|
provide: HTTP_INTERCEPTORS,
|
||||||
useClass: LogInterceptor,
|
useClass: LogInterceptor,
|
||||||
multi: true,
|
multi: true,
|
||||||
},
|
},
|
||||||
{ provide: CookieService, useValue: new CookieServiceMock() },
|
{ provide: CookieService, useValue: new CookieServiceMock() },
|
||||||
{ provide: Router, useValue: router },
|
{ provide: Router, useValue: router },
|
||||||
@@ -51,8 +58,8 @@ describe('LogInterceptor', () => {
|
|||||||
{ provide: UUIDService, useClass: UUIDService },
|
{ provide: UUIDService, useClass: UUIDService },
|
||||||
provideHttpClient(withInterceptorsFromDi()),
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
provideHttpClientTesting(),
|
provideHttpClientTesting(),
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
service = TestBed.inject(DspaceRestService);
|
service = TestBed.inject(DspaceRestService);
|
||||||
httpMock = TestBed.inject(HttpTestingController);
|
httpMock = TestBed.inject(HttpTestingController);
|
||||||
|
@@ -1,4 +1,9 @@
|
|||||||
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
|
import {
|
||||||
|
HttpEvent,
|
||||||
|
HttpHandler,
|
||||||
|
HttpInterceptor,
|
||||||
|
HttpRequest,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
import { HttpHeaders, HttpParams } from '@angular/common/http';
|
import {
|
||||||
|
HttpHeaders,
|
||||||
|
HttpParams,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { ReplaceOperation } from 'fast-json-patch';
|
import { ReplaceOperation } from 'fast-json-patch';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
import {
|
||||||
|
HttpClient,
|
||||||
|
HttpHeaders,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { ReplaceOperation } from 'fast-json-patch';
|
import { ReplaceOperation } from 'fast-json-patch';
|
||||||
import {
|
import {
|
||||||
cold,
|
cold,
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
import {
|
||||||
|
HttpClient,
|
||||||
|
HttpHeaders,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { waitForAsync } from '@angular/core/testing';
|
import { waitForAsync } from '@angular/core/testing';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import {
|
import {
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
import {
|
||||||
|
HttpClient,
|
||||||
|
HttpHeaders,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
@@ -1,5 +1,12 @@
|
|||||||
import { HttpClient, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
import {
|
||||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
HttpClient,
|
||||||
|
provideHttpClient,
|
||||||
|
withInterceptorsFromDi,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import {
|
||||||
|
HttpTestingController,
|
||||||
|
provideHttpClientTesting,
|
||||||
|
} from '@angular/common/http/testing';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { RESTURLCombiner } from '../url-combiner/rest-url-combiner';
|
import { RESTURLCombiner } from '../url-combiner/rest-url-combiner';
|
||||||
@@ -14,9 +21,13 @@ describe(`BrowserXSRFService`, () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [],
|
imports: [],
|
||||||
providers: [BrowserXSRFService, provideHttpClient(withInterceptorsFromDi()), provideHttpClientTesting()]
|
providers: [
|
||||||
});
|
BrowserXSRFService,
|
||||||
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
|
provideHttpClientTesting(),
|
||||||
|
],
|
||||||
|
});
|
||||||
httpClient = TestBed.inject(HttpClient);
|
httpClient = TestBed.inject(HttpClient);
|
||||||
httpTestingController = TestBed.inject(HttpTestingController);
|
httpTestingController = TestBed.inject(HttpTestingController);
|
||||||
service = TestBed.inject(BrowserXSRFService);
|
service = TestBed.inject(BrowserXSRFService);
|
||||||
|
@@ -1,5 +1,14 @@
|
|||||||
import { HTTP_INTERCEPTORS, HttpHeaders, HttpXsrfTokenExtractor, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
import {
|
||||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
HTTP_INTERCEPTORS,
|
||||||
|
HttpHeaders,
|
||||||
|
HttpXsrfTokenExtractor,
|
||||||
|
provideHttpClient,
|
||||||
|
withInterceptorsFromDi,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import {
|
||||||
|
HttpTestingController,
|
||||||
|
provideHttpClientTesting,
|
||||||
|
} from '@angular/common/http/testing';
|
||||||
import { TestBed } from '@angular/core/testing';
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { CookieServiceMock } from '../../shared/mocks/cookie.service.mock';
|
import { CookieServiceMock } from '../../shared/mocks/cookie.service.mock';
|
||||||
@@ -28,20 +37,20 @@ describe(`XsrfInterceptor`, () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [],
|
imports: [],
|
||||||
providers: [
|
providers: [
|
||||||
DspaceRestService,
|
DspaceRestService,
|
||||||
{
|
{
|
||||||
provide: HTTP_INTERCEPTORS,
|
provide: HTTP_INTERCEPTORS,
|
||||||
useClass: XsrfInterceptor,
|
useClass: XsrfInterceptor,
|
||||||
multi: true,
|
multi: true,
|
||||||
},
|
},
|
||||||
{ provide: HttpXsrfTokenExtractor, useValue: new HttpXsrfTokenExtractorMock(testToken) },
|
{ provide: HttpXsrfTokenExtractor, useValue: new HttpXsrfTokenExtractorMock(testToken) },
|
||||||
{ provide: CookieService, useValue: new CookieServiceMock() },
|
{ provide: CookieService, useValue: new CookieServiceMock() },
|
||||||
provideHttpClient(withInterceptorsFromDi()),
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
provideHttpClientTesting(),
|
provideHttpClientTesting(),
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
service = TestBed.get(DspaceRestService);
|
service = TestBed.get(DspaceRestService);
|
||||||
httpMock = TestBed.get(HttpTestingController);
|
httpMock = TestBed.get(HttpTestingController);
|
||||||
|
@@ -1,4 +1,12 @@
|
|||||||
import { HttpErrorResponse, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse, HttpXsrfTokenExtractor } from '@angular/common/http';
|
import {
|
||||||
|
HttpErrorResponse,
|
||||||
|
HttpEvent,
|
||||||
|
HttpHandler,
|
||||||
|
HttpInterceptor,
|
||||||
|
HttpRequest,
|
||||||
|
HttpResponse,
|
||||||
|
HttpXsrfTokenExtractor,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
Observable,
|
Observable,
|
||||||
|
@@ -1,4 +1,11 @@
|
|||||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
import {
|
||||||
|
provideHttpClient,
|
||||||
|
withInterceptorsFromDi,
|
||||||
|
} from '@angular/common/http';
|
||||||
|
import {
|
||||||
|
HttpTestingController,
|
||||||
|
provideHttpClientTesting,
|
||||||
|
} from '@angular/common/http/testing';
|
||||||
import {
|
import {
|
||||||
DebugElement,
|
DebugElement,
|
||||||
NO_ERRORS_SCHEMA,
|
NO_ERRORS_SCHEMA,
|
||||||
@@ -22,7 +29,6 @@ import {
|
|||||||
import { LangConfig } from '../../../config/lang-config.interface';
|
import { LangConfig } from '../../../config/lang-config.interface';
|
||||||
import { LocaleService } from '../../core/locale/locale.service';
|
import { LocaleService } from '../../core/locale/locale.service';
|
||||||
import { LangSwitchComponent } from './lang-switch.component';
|
import { LangSwitchComponent } from './lang-switch.component';
|
||||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
|
||||||
|
|
||||||
// This test is completely independent from any message catalogs or keys in the codebase
|
// This test is completely independent from any message catalogs or keys in the codebase
|
||||||
// The translation module is instantiated with these bogus messages that we aren't using anyway.
|
// The translation module is instantiated with these bogus messages that we aren't using anyway.
|
||||||
@@ -81,17 +87,17 @@ describe('LangSwitchComponent', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
imports: [TranslateModule.forRoot({
|
imports: [TranslateModule.forRoot({
|
||||||
loader: { provide: TranslateLoader, useClass: CustomLoader },
|
loader: { provide: TranslateLoader, useClass: CustomLoader },
|
||||||
}), LangSwitchComponent],
|
}), LangSwitchComponent],
|
||||||
providers: [
|
providers: [
|
||||||
TranslateService,
|
TranslateService,
|
||||||
{ provide: LocaleService, useValue: getMockLocaleService() },
|
{ provide: LocaleService, useValue: getMockLocaleService() },
|
||||||
provideHttpClient(withInterceptorsFromDi()),
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
provideHttpClientTesting(),
|
provideHttpClientTesting(),
|
||||||
]
|
],
|
||||||
}).compileComponents()
|
}).compileComponents()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
translate = TestBed.inject(TranslateService);
|
translate = TestBed.inject(TranslateService);
|
||||||
translate.addLangs(mockConfig.languages.filter((langConfig: LangConfig) => langConfig.active === true).map((a) => a.code));
|
translate.addLangs(mockConfig.languages.filter((langConfig: LangConfig) => langConfig.active === true).map((a) => a.code));
|
||||||
@@ -166,17 +172,17 @@ describe('LangSwitchComponent', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
schemas: [NO_ERRORS_SCHEMA],
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
imports: [TranslateModule.forRoot({
|
imports: [TranslateModule.forRoot({
|
||||||
loader: { provide: TranslateLoader, useClass: CustomLoader },
|
loader: { provide: TranslateLoader, useClass: CustomLoader },
|
||||||
}), LangSwitchComponent],
|
}), LangSwitchComponent],
|
||||||
providers: [
|
providers: [
|
||||||
TranslateService,
|
TranslateService,
|
||||||
{ provide: LocaleService, useValue: getMockLocaleService() },
|
{ provide: LocaleService, useValue: getMockLocaleService() },
|
||||||
provideHttpClient(withInterceptorsFromDi()),
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
provideHttpClientTesting(),
|
provideHttpClientTesting(),
|
||||||
]
|
],
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
translate = TestBed.inject(TranslateService);
|
translate = TestBed.inject(TranslateService);
|
||||||
translate.addLangs(mockConfig.languages.filter((MyLangConfig) => MyLangConfig.active === true).map((a) => a.code));
|
translate.addLangs(mockConfig.languages.filter((MyLangConfig) => MyLangConfig.active === true).map((a) => a.code));
|
||||||
translate.setDefaultLang('en');
|
translate.setDefaultLang('en');
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
import { HttpHeaders, HttpResponse } from '@angular/common/http';
|
import {
|
||||||
|
HttpHeaders,
|
||||||
|
HttpResponse,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
|
|
||||||
import { RestRequestMethod } from '../../../core/data/rest-request-method';
|
import { RestRequestMethod } from '../../../core/data/rest-request-method';
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
import {
|
||||||
|
HttpClient,
|
||||||
|
HttpHeaders,
|
||||||
|
} from '@angular/common/http';
|
||||||
import {
|
import {
|
||||||
Inject,
|
Inject,
|
||||||
Injectable,
|
Injectable,
|
||||||
|
@@ -1,4 +1,8 @@
|
|||||||
import { HttpClient, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
import {
|
||||||
|
HttpClient,
|
||||||
|
provideHttpClient,
|
||||||
|
withInterceptorsFromDi,
|
||||||
|
} from '@angular/common/http';
|
||||||
import {
|
import {
|
||||||
APP_ID,
|
APP_ID,
|
||||||
APP_INITIALIZER,
|
APP_INITIALIZER,
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
import { DragDropModule } from '@angular/cdk/drag-drop';
|
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
import {
|
||||||
|
provideHttpClient,
|
||||||
|
withInterceptorsFromDi,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
@@ -203,19 +206,24 @@ const DECLARATIONS = [
|
|||||||
SearchResultsSkeletonComponent,
|
SearchResultsSkeletonComponent,
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({ imports: [RootModule,
|
@NgModule({
|
||||||
CommonModule,
|
imports: [RootModule,
|
||||||
DragDropModule,
|
CommonModule,
|
||||||
FormsModule,
|
DragDropModule,
|
||||||
NgbModule,
|
FormsModule,
|
||||||
RouterModule,
|
NgbModule,
|
||||||
ScrollToModule,
|
RouterModule,
|
||||||
StoreModule,
|
ScrollToModule,
|
||||||
StoreRouterConnectingModule,
|
StoreModule,
|
||||||
TranslateModule,
|
StoreRouterConnectingModule,
|
||||||
FormsModule,
|
TranslateModule,
|
||||||
NgxGalleryModule,
|
FormsModule,
|
||||||
...DECLARATIONS], providers: [provideHttpClient(withInterceptorsFromDi())] })
|
NgxGalleryModule,
|
||||||
|
...DECLARATIONS],
|
||||||
|
providers: [
|
||||||
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module serves as an index for all the components in this theme.
|
* This module serves as an index for all the components in this theme.
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
import { DragDropModule } from '@angular/cdk/drag-drop';
|
import { DragDropModule } from '@angular/cdk/drag-drop';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
|
import {
|
||||||
|
provideHttpClient,
|
||||||
|
withInterceptorsFromDi,
|
||||||
|
} from '@angular/common/http';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { RouterModule } from '@angular/router';
|
import { RouterModule } from '@angular/router';
|
||||||
@@ -15,17 +18,25 @@ import { RootModule } from '../../app/root.module';
|
|||||||
const DECLARATIONS = [
|
const DECLARATIONS = [
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({ declarations: DECLARATIONS, imports: [RootModule,
|
@NgModule({
|
||||||
CommonModule,
|
declarations: DECLARATIONS,
|
||||||
DragDropModule,
|
imports: [
|
||||||
FormsModule,
|
RootModule,
|
||||||
NgbModule,
|
CommonModule,
|
||||||
RouterModule,
|
DragDropModule,
|
||||||
ScrollToModule,
|
FormsModule,
|
||||||
StoreModule,
|
NgbModule,
|
||||||
StoreRouterConnectingModule,
|
RouterModule,
|
||||||
TranslateModule,
|
ScrollToModule,
|
||||||
FormsModule], providers: [provideHttpClient(withInterceptorsFromDi())] })
|
StoreModule,
|
||||||
|
StoreRouterConnectingModule,
|
||||||
|
TranslateModule,
|
||||||
|
FormsModule,
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
provideHttpClient(withInterceptorsFromDi()),
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module serves as an index for all the components in this theme.
|
* This module serves as an index for all the components in this theme.
|
||||||
|
Reference in New Issue
Block a user