Untitled

mail@pastecode.io avatar
unknown
plain_text
14 days ago
2.0 kB
3
Indexable
Never
import { FormBuilder } from '@angular/forms';
import { of } from 'rxjs';
import { EinterviewModalComponent } from './einterview-modal.component';

describe('SecondaryModalComponent', () => {
  let fixture: EinterviewModalComponent;
  let secondaryModalMock;
  let secondaryModalDataMock;
  let InterviewInfoService;
  let utilService;
  let modeMock;
  let toasterService;
  let fg;
  let storageService;
  beforeEach(async () => {
    secondaryModalMock = {
      close: jest.fn(),
    };
    modeMock = {
      open: jest.fn(),
    };
    toasterService = {
      showToaster: jest.fn(),
    };
    storageService = {
      isJointInsuredExist:false,
    };
    fg = new FormBuilder();
    secondaryModalDataMock = {};
    InterviewInfoService = {
      cloneTeleApp: jest.fn().mockReturnValue(of({})),
      initiateInterview: jest.fn().mockReturnValue(of({})),
    };
    utilService = {
      isMoneyGaurdPolicy: jest.fn().mockReturnValue(of({})),
    };
    fixture = new EinterviewModalComponent(
      InterviewInfoService,
      utilService,
      fg,
      secondaryModalMock,
      modeMock,
      toasterService,
      secondaryModalDataMock,
      storageService
    );
  });

  describe('EinterviewModalComponent component', () => {
    describe('ngOnInit', () => {
      it('Should initiate ngOnInit function', () => {
        fixture.ngOnInit();
        expect(fixture).toBeTruthy();
      });
      it('Should call onSecondaryModalClose function', () => {
        const spyFn = jest.spyOn(fixture, 'onSecondaryModalClose');
        fixture.onSecondaryModalClose();
        expect(spyFn).toHaveBeenCalled();
      });
      it('Should call processButtonFunctionality function', () => {
        fixture.buttonList = [{ name: 'SEND LINK' }];
        const spyFn = jest.spyOn(fixture, 'processButtonFunctionality');
        fixture.processButtonFunctionality('SEND LINK', 'SEND LINK', 0);
        expect(spyFn).toHaveBeenCalled();
      });
    });
  });
});
Leave a Comment