Skip to content

Commit

Permalink
non-FragmentResource version of usePaginationFragment
Browse files Browse the repository at this point in the history
Summary:
Implements a new version of `usePaginationFragment()` backed by the new `useFragmentInternal()` and `useRefetchableFragmentInternal()`. The majority of the work here is reworking the unit test for this hook to test both environments. I ran into what I believe is a Jest bug related to `doMock()`, where for some reason the `unsubscribe` mock function identity was getting lost, and assertions about the number of unsubscribes were failing despite the function clearly being called the right number of times (confirmed with logging). I also got different results with `fit()` to isolate tests, where they would pass when focused but not when run with all tests. Given that these same tests worked before switching to describe.each, and i didn't change anything else substantial about the file (at that point), it makes me suspicious of a Jest bug.

The use of the mock environment, and doMock generally, has always been a code smell though, so i refactored the test to use a normal environment instance and only mock the network layer.

Reviewed By: davidmccabe

Differential Revision: D37125130

fbshipit-source-id: 25e9b47d72f6d3631b6da7c5242df8017ad12e94
  • Loading branch information
josephsavona authored and facebook-github-bot committed Jun 16, 2022
1 parent 3281299 commit 64d4dc1
Show file tree
Hide file tree
Showing 2 changed files with 405 additions and 214 deletions.
Loading

0 comments on commit 64d4dc1

Please sign in to comment.