Summary Table

Categories Total Count
PII 0
URL 2
DNS 2
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

// import { AuthenticationService } from './login.service';
// import { DomSanitizer } from '@angular/platform-browser';

// import { Observable } from 'rxjs/Observable';
// import { Observer } from 'rxjs/Observer';

// import { LoginComponent } from './login.component';
// import { SsoEncodedUrlsModel } from './login.model';

// describe('LoginComponent', () => {
// let component: LoginComponent;

// let authenticationService: AuthenticationService;
// let sanitizer;

// beforeEach(() => {
// authenticationService = new AuthenticationService(null);
// sanitizer = { bypassSecurityTrustUrl: () => true };

// component = new LoginComponent(authenticationService, sanitizer, null);
// });

// it('should be created', () => {
// expect(component).toBeTruthy();
// });

// it('test ngOnInit: normal return with no errors on call to "authenticationService.ssoUrls" method', () => {
// let getErrorMsgReturnData = {
// errorMsg: 'Error Message from call to getErrorMsg method!',
// errorStatus: true
// };
// spyOn(authenticationService, 'getErrorMsg').and.callFake(
// () => new Observable((observer: Observer<{}>) => observer.next(getErrorMsgReturnData))
// );

// let returnedSsoUrlsData = new SsoEncodedUrlsModel();
// spyOn(authenticationService, 'ssoUrls').and.callFake(
// () => new Observable((observer: Observer<{}>) => observer.next(returnedSsoUrlsData))
// );

// let bypassSecurityTrustUrlReturnedData = 'A_SAFE_URL';
// spyOn(sanitizer, 'bypassSecurityTrustUrl').and.callFake(
// () => bypassSecurityTrustUrlReturnedData
// );

// spyOn(console, 'log');

// expect(component.errorMsg).toEqual('');
// expect(component.errorStatus).toEqual(false);
// expect(component.sso).toEqual(undefined);
// expect(component.safeUrl).toEqual(undefined);

// component.ngOnInit();

// expect(authenticationService.getErrorMsg).toHaveBeenCalled();
// expect(authenticationService.ssoUrls).toHaveBeenCalled();
// expect(sanitizer.bypassSecurityTrustUrl).toHaveBeenCalled();
// expect(sanitizer.bypassSecurityTrustUrl).toHaveBeenCalledWith(
// 'https://
DNS.URL /ApplicationManager/Authenticate/Post');
// expect(console.log).not.toHaveBeenCalled();

// expect(component.errorMsg).toEqual(getErrorMsgReturnData.errorMsg);
// expect(component.errorStatus).toEqual(true);
// expect(component.sso).toEqual(returnedSsoUrlsData);
// expect(component.safeUrl).toEqual('A_SAFE_URL');
// });

// it('test ngOnInit: error return on call to "authenticationService.ssoUrls" method', () => {
// let getErrorMsgReturnData = {
// errorMsg: '',
// errorStatus: false
// };
// spyOn(authenticationService, 'getErrorMsg').and.callFake(
// () => new Observable((observer: Observer<{}>) => observer.next(getErrorMsgReturnData))
// );

// let returnedSsoUrlsError = {
// message: 'Error Message from call to ssoUrls method!'
// }
// spyOn(authenticationService, 'ssoUrls').and.returnValue(Observable.throw(returnedSsoUrlsError));

// let bypassSecurityTrustUrlReturnedData = 'A_SAFE_URL';
// spyOn(sanitizer, 'bypassSecurityTrustUrl').and.callFake(
// () => bypassSecurityTrustUrlReturnedData
// );

// spyOn(console, 'log');

// expect(component.errorMsg).toEqual('');
// expect(component.errorStatus).toEqual(false);
// expect(component.sso).toEqual(undefined);
// expect(component.safeUrl).toEqual(undefined);

// component.ngOnInit();

// expect(authenticationService.getErrorMsg).toHaveBeenCalled();
// expect(authenticationService.ssoUrls).toHaveBeenCalled();
// expect(sanitizer.bypassSecurityTrustUrl).toHaveBeenCalled();
// expect(sanitizer.bypassSecurityTrustUrl).toHaveBeenCalledWith(
// 'https://
DNS.URL /ApplicationManager/Authenticate/Post');
// expect(console.log).toHaveBeenCalled();
// expect(console.log).toHaveBeenCalledWith(returnedSsoUrlsError);

// expect(component.errorMsg).toEqual(returnedSsoUrlsError.message);
// expect(component.errorStatus).toEqual(false);
// expect(component.sso).toEqual(undefined);
// expect(component.safeUrl).toEqual('A_SAFE_URL');
// });

// it('test accept method:', () => {
// component.sso = new SsoEncodedUrlsModel();

// let returnNtName = 'NT_NAME';
// let returnedNtNameObservable = new Observable((observer: Observer<{}>) => observer.next(returnNtName));
// spyOn(authenticationService, 'getNtName').and.callFake(
// () => returnedNtNameObservable
// );

// spyOn(returnedNtNameObservable, 'subscribe');

// component.accept();

// expect(authenticationService.getNtName).toHaveBeenCalled();
// expect(authenticationService.getNtName).toHaveBeenCalledWith(component.sso);
// expect(returnedNtNameObservable.subscribe).toHaveBeenCalled();
// });

// });