Testing and mocking lettable operators in RxJS 5.5

前端 未结 5 2122
你的背包
你的背包 2020-12-17 22:26

Before lettable operator, I did a helper to modify debounceTime method, so it uses a TestScheduler:

export function mockDebounceTime(
    scheduler: TestSche         


        
5条回答
  •  醉梦人生
    2020-12-17 22:45

    I had some problems with the answers above (can't have multiple spies on Observable.prototype, ...), relevant for me was only mocking "debounceTime" so I moved the actual debounceTime (e.g. filterTextDebounceTime = 200) to an variable in the component and in the spec's "beforeEach" I'm setting the component.filterTextDebounceTime to 0 so debounceTime is working synchronously/blocking.

提交回复
热议问题