-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(stream): correct typing issue when detecting DebounceRenderStrategy
- Loading branch information
1 parent
63b4690
commit 20c0a4e
Showing
3 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import {setupOperator$} from "./setup-operator"; | ||
import {debounceTime, Observable, of, pipe, throttleTime} from "rxjs"; | ||
import {RenderStrategies} from "../types/render-strategies"; | ||
import {subscribeSpyTo} from "@hirez_io/observer-spy"; | ||
|
||
describe(`${setupOperator$.name}`, () => { | ||
it('should emit throttleTime-operator for ThrottleStrategy', () => { | ||
const renderStrategy$: Observable<RenderStrategies> = of({type: 'throttle', throttleInMs: 1000}); | ||
|
||
const operator$ = setupOperator$(renderStrategy$); | ||
|
||
const result = subscribeSpyTo(operator$); | ||
|
||
expect(result.getLastValue()).toEqual(throttleTime(1000)); | ||
}) | ||
it('should emit debounce-operator for DebounceStrategy', () => { | ||
const renderStrategy$: Observable<RenderStrategies> = of({type: 'debounce', debounceInMs: 1000}); | ||
|
||
const operator$ = setupOperator$(renderStrategy$); | ||
|
||
const result = subscribeSpyTo(operator$); | ||
|
||
expect(result.getLastValue()).toEqual(debounceTime(1000)); | ||
}) | ||
|
||
it('should emit empty-operator for DefaultStrategy', () => { | ||
const renderStrategy$: Observable<RenderStrategies> = of({type: 'default'}); | ||
|
||
const operator$ = setupOperator$(renderStrategy$); | ||
|
||
const result = subscribeSpyTo(operator$); | ||
|
||
expect(result.getLastValue()).toEqual(pipe()); | ||
}); | ||
|
||
it('should emit empty-operator when no strategy matches', () => { | ||
const renderStrategy$: Observable<RenderStrategies> = of(null as unknown as RenderStrategies); | ||
|
||
const operator$ = setupOperator$(renderStrategy$); | ||
|
||
const result = subscribeSpyTo(operator$); | ||
|
||
expect(result.getLastValue()).toEqual(pipe()); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters