mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
Fix AuthInterceptor no expectation tests
- Removed duplicate request - Added expect().nothing() because httpMock.expectNone will throw an error when a request is made
This commit is contained in:
@@ -20,9 +20,7 @@ describe(`AuthInterceptor`, () => {
|
|||||||
|
|
||||||
const authServiceStub = new AuthServiceStub();
|
const authServiceStub = new AuthServiceStub();
|
||||||
const store: Store<TruncatablesState> = jasmine.createSpyObj('store', {
|
const store: Store<TruncatablesState> = jasmine.createSpyObj('store', {
|
||||||
/* eslint-disable no-empty,@typescript-eslint/no-empty-function */
|
|
||||||
dispatch: {},
|
dispatch: {},
|
||||||
/* eslint-enable no-empty, @typescript-eslint/no-empty-function */
|
|
||||||
select: observableOf(true)
|
select: observableOf(true)
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -46,6 +44,10 @@ describe(`AuthInterceptor`, () => {
|
|||||||
httpMock = TestBed.inject(HttpTestingController);
|
httpMock = TestBed.inject(HttpTestingController);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
httpMock.verify();
|
||||||
|
});
|
||||||
|
|
||||||
describe('when has a valid token', () => {
|
describe('when has a valid token', () => {
|
||||||
|
|
||||||
it('should not add an Authorization header when we’re sending a HTTP request to \'authn\' endpoint that is not the logout endpoint', () => {
|
it('should not add an Authorization header when we’re sending a HTTP request to \'authn\' endpoint that is not the logout endpoint', () => {
|
||||||
@@ -95,14 +97,11 @@ describe(`AuthInterceptor`, () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should redirect to login', () => {
|
it('should redirect to login', () => {
|
||||||
|
|
||||||
service.request(RestRequestMethod.POST, 'dspace-spring-rest/api/submission/workspaceitems', 'password=password&user=user').subscribe((response) => {
|
|
||||||
expect(response).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
service.request(RestRequestMethod.POST, 'dspace-spring-rest/api/submission/workspaceitems', 'password=password&user=user');
|
service.request(RestRequestMethod.POST, 'dspace-spring-rest/api/submission/workspaceitems', 'password=password&user=user');
|
||||||
|
|
||||||
httpMock.expectNone('dspace-spring-rest/api/submission/workspaceitems');
|
httpMock.expectNone('dspace-spring-rest/api/submission/workspaceitems');
|
||||||
|
// HttpTestingController.expectNone will throw an error when a requests is made
|
||||||
|
expect().nothing();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user