@@ -26,7 +26,7 @@ import { of } from 'rxjs';
2626
2727import { storeModuleConfig } from '../../app.reducer' ;
2828import { AlertComponent } from '../../shared/alert/alert.component' ;
29- import { AuthMethodsService } from '../../shared/log-in/services/auth-methods.service ' ;
29+ import { ThemedLogInComponent } from '../../shared/log-in/themed-log-in.component ' ;
3030import { getMockThemeService } from '../../shared/theme-support/test/theme-service.mock' ;
3131import { ThemeService } from '../../shared/theme-support/theme.service' ;
3232import { ConfirmEmailComponent } from '../email-confirmation/confirm-email/confirm-email.component' ;
@@ -36,9 +36,13 @@ import { ExternalLogInComponent } from './external-log-in.component';
3636describe ( 'ExternalLogInComponent' , ( ) => {
3737 let component : ExternalLogInComponent ;
3838 let fixture : ComponentFixture < ExternalLogInComponent > ;
39- let modalService : NgbModal = jasmine . createSpyObj ( 'modalService' , [ 'open' ] ) ;
40- let authServiceStub : jasmine . SpyObj < AuthService > ;
41- let authMethodsServiceStub : jasmine . SpyObj < AuthMethodsService > ;
39+ let modalRef = Object . defineProperty ( {
40+ close : jasmine . createSpy ( 'close' ) ,
41+ } ,
42+ 'dismissed' , {
43+ get : ( ) => of ( ) ,
44+ } ) ;
45+ let modalService = jasmine . createSpyObj ( 'modalService' , [ 'open' ] ) ;
4246 let mockAuthMethodsArray : AuthMethod [ ] = [
4347 { id : 'password' , authMethodType : AuthMethodType . Password , position : 2 } as AuthMethod ,
4448 { id : 'shibboleth' , authMethodType : AuthMethodType . Shibboleth , position : 1 } as AuthMethod ,
@@ -81,6 +85,8 @@ describe('ExternalLogInComponent', () => {
8185 } ;
8286
8387 beforeEach ( async ( ) => {
88+ modalService . open . and . returnValue ( modalRef ) ;
89+
8490 await TestBed . configureTestingModule ( {
8591 imports : [
8692 TranslateModule . forRoot ( ) ,
@@ -103,14 +109,15 @@ describe('ExternalLogInComponent', () => {
103109 ConfirmEmailComponent ,
104110 ProvideEmailComponent ,
105111 AlertComponent ,
112+ ThemedLogInComponent ,
106113 ] ,
107114 } ,
108115 } ) . compileComponents ( ) ;
109116 } ) ;
110117 beforeEach ( ( ) => {
111118 fixture = TestBed . createComponent ( ExternalLogInComponent ) ;
112119 component = fixture . componentInstance ;
113- component . registrationData = Object . assign ( new Registration ( ) , registrationDataMock ) ;
120+ component . registrationData = Object . assign ( new Registration ( ) , registrationDataMock , { email : 'user@institution.edu' } ) ;
114121 component . registrationType = registrationDataMock . registrationType ;
115122 fixture . detectChanges ( ) ;
116123 } ) ;
@@ -120,12 +127,6 @@ describe('ExternalLogInComponent', () => {
120127 expect ( component ) . toBeTruthy ( ) ;
121128 } ) ;
122129
123- beforeEach ( ( ) => {
124- component . registrationData = Object . assign ( new Registration ( ) , registrationDataMock , { email : 'user@institution.edu' } ) ;
125-
126- fixture . detectChanges ( ) ;
127- } ) ;
128-
129130 it ( 'should set registrationType and informationText correctly when email is present' , ( ) => {
130131 expect ( component . registrationType ) . toBe ( registrationDataMock . registrationType ) ;
131132 expect ( component . informationText ) . toBeDefined ( ) ;
0 commit comments