mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
55143: fixed all tests
This commit is contained in:
@@ -4,8 +4,7 @@ import { provideMockActions } from '@ngrx/effects/testing';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { cold, hot } from 'jasmine-marbles';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import { of as observableOf, throwError as observableThrow } from 'rxjs';
|
||||
import { Observable, of as observableOf, throwError as observableThrow } from 'rxjs';
|
||||
|
||||
import { AuthEffects } from './auth.effects';
|
||||
import {
|
||||
@@ -30,16 +29,21 @@ import { EPersonMock } from '../../shared/testing/eperson-mock';
|
||||
describe('AuthEffects', () => {
|
||||
let authEffects: AuthEffects;
|
||||
let actions: Observable<any>;
|
||||
const authServiceStub = new AuthServiceStub();
|
||||
let authServiceStub;
|
||||
const store: Store<TruncatablesState> = jasmine.createSpyObj('store', {
|
||||
/* tslint:disable:no-empty */
|
||||
dispatch: {},
|
||||
/* tslint:enable:no-empty */
|
||||
select: observableOf(true)
|
||||
});
|
||||
const token = authServiceStub.getToken();
|
||||
let token;
|
||||
|
||||
function init() {
|
||||
authServiceStub = new AuthServiceStub();
|
||||
token = authServiceStub.getToken();
|
||||
}
|
||||
beforeEach(() => {
|
||||
init();
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
AuthEffects,
|
||||
@@ -138,7 +142,7 @@ describe('AuthEffects', () => {
|
||||
|
||||
describe('when check token failed', () => {
|
||||
it('should return a CHECK_AUTHENTICATION_TOKEN_ERROR action in response to a CHECK_AUTHENTICATION_TOKEN action', () => {
|
||||
spyOn((authEffects as any).authService, 'hasValidAuthenticationToken').and.returnValue(Observable.throw(''));
|
||||
spyOn((authEffects as any).authService, 'hasValidAuthenticationToken').and.returnValue(observableThrow(''));
|
||||
|
||||
actions = hot('--a-', {a: {type: AuthActionTypes.CHECK_AUTHENTICATION_TOKEN, payload: token}});
|
||||
|
||||
|
Reference in New Issue
Block a user