Answers for "angular jasmin BsModalService"

2

angular jasmin BsModalService

//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