-
Notifications
You must be signed in to change notification settings - Fork 2
[CSL-3123] Pagination component and hook SSR tests #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CSL-3123] Pagination component and hook SSR tests #47
Conversation
CSL-3123 [OS UI PLP] React Serve Tests - Pagination
Business Outcome:
Definition of done:
|
| }) => { | ||
| const [totalPages, setTotalPages] = useState(0); | ||
| const [currentPage, setCurrentPage] = useState<number>(); | ||
| const [currentPage, setCurrentPage] = useState<number | undefined>(initialPage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're passing initialPage here I think we need to remove this useEffect right?
useEffect(() => {
if (initialPage) {
setCurrentPage(initialPage);
}
}, [initialPage]);
| const { result } = renderHookServerSide(() => usePagination(paginationProps), {}); | ||
| expect(result.totalPages).toBe(0); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's test that pages returned from usePagination is an empty array
spec/usePagination.server.test.js
Outdated
| windowSize: 10, | ||
| }; | ||
|
|
||
| describe('usePagination', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just so we're consistent with the other tests for the server tests we describe it like "Testing Hook on the server: usePagination"
mocca102
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left small comments. But looking good overall
mocca102
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making the changes! LGTM!
No description provided.