mirror of
https://github.com/re-rxjs/react-rxjs.git
synced 2025-12-08 18:01:51 +00:00
test(core): missing test for connectFactoryObservable
This commit is contained in:
parent
ce05cf36b4
commit
ea14185628
@ -402,6 +402,30 @@ describe("connectFactoryObservable", () => {
|
||||
|
||||
expect(errorCallback).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("does not resubscribe to an observable that emits synchronously and that does not have a top-level subscription after a re-render", () => {
|
||||
let nTopSubscriptions = 0
|
||||
|
||||
const [useNTopSubscriptions] = bind((id: number) =>
|
||||
defer(() => {
|
||||
return of(++nTopSubscriptions + id)
|
||||
}),
|
||||
)
|
||||
|
||||
const { result, rerender, unmount } = renderHook(() =>
|
||||
useNTopSubscriptions(0),
|
||||
)
|
||||
|
||||
expect(result.current).toBe(2)
|
||||
|
||||
actHook(() => {
|
||||
rerender()
|
||||
})
|
||||
expect(result.current).toBe(2)
|
||||
expect(nTopSubscriptions).toBe(2)
|
||||
|
||||
unmount()
|
||||
})
|
||||
})
|
||||
|
||||
describe("observable", () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user