Skip to content

Commit

Permalink
[organization] updated organization screen
Browse files Browse the repository at this point in the history
filtered out events from action items and created unit test to verify only action items are being displayed
  • Loading branch information
Alfredoeb9 committed Jul 12, 2024
1 parent 836b534 commit 14bda33
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/screens/OrganizationActionItems/OrganizationActionItemMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,35 @@ export const MOCKS = [
lastName: 'Shepherd',
},
},
{
_id: 'actionItem2',
assignee: {
_id: 'user2',
firstName: 'John',
lastName: 'Doe',
},
actionItemCategory: {
_id: 'actionItemCategory2',
name: 'ActionItemCategory 2',
},
preCompletionNotes: 'Pre Completion Notes',
postCompletionNotes: 'Post Completion Notes',
assignmentDate: '2024-02-14',
dueDate: '2024-02-21',
completionDate: '2024-02-21',
isCompleted: false,
assigner: {
_id: 'user0',
firstName: 'Wilt',
lastName: 'Shepherd',
},
event: null,
creator: {
_id: 'user0',
firstName: 'Wilt',
lastName: 'Shepherd',
},
},
],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,4 +594,26 @@ describe('Testing Action Item Categories Component', () => {
expect(toast.error).toHaveBeenCalled();
});
});

test('Testing Only Action Items Displaying', async () => {
const mockApp = render(
<MockedProvider addTypename={false} link={link}>
<Provider store={store}>
<BrowserRouter>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<I18nextProvider i18n={i18n}>
{<OrganizationActionItems />}
</I18nextProvider>
</LocalizationProvider>
</BrowserRouter>
</Provider>
</MockedProvider>,
);

await waitFor(mockApp.asFragment);

const actionItem = screen.getByText(/John Doe/i);

expect(actionItem).toContainHTML('John Doe');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ function organizationActionItems(): JSX.Element {
(category) => !category.isDisabled,
);

const actionItemOnly = actionItemsData?.actionItemsByOrganization.filter(
(item) => item.event == null,
);

return (
<div className={styles.organizationActionItemsContainer}>
<div className={`${styles.container} bg-white rounded-4 my-3`}>
Expand Down Expand Up @@ -365,7 +369,7 @@ function organizationActionItems(): JSX.Element {

<ActionItemsContainer
actionItemsConnection={`Organization`}
actionItemsData={actionItemsData?.actionItemsByOrganization}
actionItemsData={actionItemOnly}
membersData={membersData?.organizations[0].members}
actionItemsRefetch={actionItemsRefetch}
/>
Expand Down

0 comments on commit 14bda33

Please sign in to comment.