UNPKG

@angular-package/testing

Version:

Jasmine unit testing wrapper with additional custom testing features.

1 lines 918 B
import{TestingCore}from"../testing-core.abstract";import{TextualExpectation}from"../textual-expectation.abstract";export class TestingItToHaveBeenCalled extends TestingCore{before(e,t=TextualExpectation.toHaveBeenCalledBefore,a,i){return this.it(t,(()=>super.expect.to.have.been.called.before(e()[0],e()[1],a)),i),this}called(e,t=TextualExpectation.toHaveBeenCalled,a,i){return this.it(t,(()=>{let t=e();(Array.isArray(t)?t:[t]).forEach((e=>super.expect.to.have.been.called.called(e,a)))}),i),this}onceWith(e=TextualExpectation.toHaveBeenCalledOnceWith,t,...a){return this.it(e,(()=>super.expect.to.have.been.called.onceWith(t(),...a)),!0),this}times(e,t,a=TextualExpectation.toHaveBeenCalledTimes,i,l){return this.it(a,(()=>super.expect.to.have.been.called.times(e(),t,i)),l),this}with(e=TextualExpectation.toHaveBeenCalledWith,t,...a){return this.it(e,(()=>super.expect.to.have.been.called.with(t(),...a)),!0),this}}