Skip to content

Latest commit

 

History

History
32 lines (17 loc) · 1.08 KB

notes.md

File metadata and controls

32 lines (17 loc) · 1.08 KB

Possible plans to test the usePagination hook

  • Create dummy api like here

  • Create a wrapper component that calls the hook which uses the api

  • The component should render a json of all values returned from hook/api

  • Have a bunch of buttons to trigger the api/hook methods eg faking error, trying out reloading, back, next etc

  • for each method, test for some data/text in the component

  • eg to test for loaded data, currentPage should = 1, loading should be false data should have length, error may or may not be null - [maybe extract to another test?]

  • to test for error display, should be an error text

  • loading false

  • text next/back by making sure curpent page is > or < prev value


Or consider using renderHook


Ideas inspired by here