This repository has been archived by the owner on Jan 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2026 from akshay-ap/feat-#1969
feat(patient): add paging and sorting functionality
- Loading branch information
Showing
17 changed files
with
778 additions
and
64 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,31 @@ | ||
import '../../__mocks__/matchMediaMock' | ||
import { Button, Select } from '@hospitalrun/components' | ||
import { mount } from 'enzyme' | ||
import React from 'react' | ||
|
||
import PageComponent, { defaultPageSize } from '../../components/PageComponent' | ||
|
||
describe('PageComponenet test', () => { | ||
it('should render PageComponent Component', () => { | ||
const wrapper = mount( | ||
<PageComponent | ||
hasNext={false} | ||
hasPrevious={false} | ||
pageNumber={1} | ||
setPreviousPageRequest={jest.fn()} | ||
setNextPageRequest={jest.fn()} | ||
onPageSizeChange={jest.fn()} | ||
/>, | ||
) | ||
const buttons = wrapper.find(Button) | ||
expect(buttons).toHaveLength(2) | ||
expect(buttons.at(0).prop('disabled')).toBeTruthy() | ||
expect(buttons.at(1).prop('disabled')).toBeTruthy() | ||
|
||
const select = wrapper.find(Select) | ||
expect(select.prop('defaultValue')).toEqual(defaultPageSize.value?.toString()) | ||
|
||
const options = select.find('option') | ||
expect(options).toHaveLength(5) | ||
}) | ||
}) |
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,15 @@ | ||
import { renderHook } from '@testing-library/react-hooks' | ||
|
||
import useUpdateEffect from '../../hooks/useUpdateEffect' | ||
|
||
describe('useUpdateEffect', () => { | ||
it('should call the function after udpate', () => { | ||
const mockFn = jest.fn() | ||
let someVal = 'someVal' | ||
const { rerender } = renderHook(() => useUpdateEffect(mockFn, [someVal])) | ||
expect(mockFn).not.toHaveBeenCalled() | ||
someVal = 'newVal' | ||
rerender() | ||
expect(mockFn).toHaveBeenCalledTimes(1) | ||
}) | ||
}) |
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
Oops, something went wrong.
8089564
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.
Successfully deployed to following URLs: