Answers for "angular jasmine BsModalService mock"

2

angular jasmine BsModalService mock

//Angular - Jasmine
//Mock BsModalService

describe('...', () => {
    //...
    const bsModalServiceStub= {
        show: jasmine.createSpy('show').and.callFake(function () {
           return {
              content: {
                 event: new EventEmitter()
              }
           };
        }),
        hide: jasmine.createSpy('hide').and.callThrough(),
     };
  	//...
    beforeEach(() => {
      TestBed.configureTestingModule({
        providers: [
          { provide: BsModalService, useValue: bsModalServiceStub }
        ]
    });
    //...
}
Posted by: Guest on August-17-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language