-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show attachment description as well as fix up some more things
- Loading branch information
1 parent
9e3fb4c
commit 7d6fed6
Showing
11 changed files
with
221 additions
and
169 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
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
40 changes: 40 additions & 0 deletions
40
packages/esm-patient-attachments-app/src/attachments/attachments-overview.test.tsx
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,40 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import AttachmentsOverview from './attachments-overview.component'; | ||
import { useAttachments } from '@openmrs/esm-framework'; | ||
|
||
const mockedUseAttachments = jest.mocked(useAttachments); | ||
|
||
it('renders a loading skeleton when attachments are loading', () => { | ||
mockedUseAttachments.mockReturnValue({ | ||
data: [], | ||
error: null, | ||
isLoading: true, | ||
isValidating: false, | ||
mutate: jest.fn(), | ||
}); | ||
|
||
renderAttachmentsOverview(); | ||
|
||
expect(screen.getByRole('progressbar')).toBeInTheDocument(); | ||
expect(screen.queryByRole('table')).not.toBeInTheDocument(); | ||
}); | ||
|
||
it('renders an empty state if attachments are not available', () => { | ||
mockedUseAttachments.mockReturnValue({ | ||
data: [], | ||
error: null, | ||
isLoading: false, | ||
isValidating: false, | ||
mutate: jest.fn(), | ||
}); | ||
|
||
renderAttachmentsOverview(); | ||
|
||
expect(screen.getByText(/There are no attachments to display for this patient/i)).toBeInTheDocument(); | ||
expect(screen.getByRole('button', { name: /record attachments/i })).toBeInTheDocument(); | ||
}); | ||
|
||
function renderAttachmentsOverview() { | ||
render(<AttachmentsOverview patientUuid="test-uuid" />); | ||
} |
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
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
Oops, something went wrong.