Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…awa-admin into session-timeoutand adjusted test and componenet files to new graphql parameter
  • Loading branch information
JordanCampbell1 committed Oct 16, 2024
2 parents c15b338 + 6467ea1 commit c5ccf4e
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"react-multi-carousel": "^2.8.5",
"react-redux": "^9.1.2",
"react-router-dom": "^6.27.0",
"react-toastify": "^10.0.5",
"react-toastify": "^10.0.6",
"react-tooltip": "^5.28.0",
"redux": "^5.0.1",
"redux-thunk": "^3.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,15 @@ describe('Testing Action Item Categories Component', () => {
'ActionItemCategory 4',
);

// userEvent.click(screen.getByTestId('disabledStatusToggle')); // Toggle the disabled status

userEvent.click(screen.getByTestId('formSubmitButton'));
});

await waitFor(() => {
expect(toast.success).toBeCalledWith(translations.successfulCreation);
expect(toast.success).toHaveBeenCalledWith(
translations.successfulCreation,
);
});
});

Expand Down Expand Up @@ -226,7 +230,9 @@ describe('Testing Action Item Categories Component', () => {
});

await waitFor(() => {
expect(toast.success).toBeCalledWith(translations.successfulUpdation);
expect(toast.success).toHaveBeenCalledWith(
translations.successfulUpdation,
);
});
});

Expand Down Expand Up @@ -300,7 +306,7 @@ describe('Testing Action Item Categories Component', () => {
});

await waitFor(() => {
expect(toast.error).toBeCalledWith(translations.sameNameConflict);
expect(toast.error).toHaveBeenCalledWith(translations.sameNameConflict);
});
});

Expand All @@ -325,15 +331,15 @@ describe('Testing Action Item Categories Component', () => {
});

await waitFor(() => {
expect(toast.success).toBeCalledWith(translations.categoryDisabled);
expect(toast.success).toHaveBeenCalledWith(translations.categoryDisabled);
});

await waitFor(() => {
userEvent.click(screen.getAllByTestId('disabilityStatusButton')[1]);
});

await waitFor(() => {
expect(toast.success).toBeCalledWith(translations.categoryEnabled);
expect(toast.success).toHaveBeenCalledWith(translations.categoryEnabled);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const OrgActionItemCategories = (): JSX.Element => {
const [categoryId, setCategoryId] = useState(''); // Current category ID for updating
const [name, setName] = useState(''); // Category name for creation or update
const [currName, setCurrName] = useState(''); // Current category name (used for comparison)
const [disabledStatus, setDisabledStatus] = useState(false);

// Fetch organization ID from URL params
const { orgId: currentUrl } = useParams();
Expand Down Expand Up @@ -73,14 +74,15 @@ const OrgActionItemCategories = (): JSX.Element => {
try {
await createActionItemCategory({
variables: {
isDisabled: disabledStatus,
name,
organizationId: currentUrl,
},
});

setName('');
refetch();

setDisabledStatus(false);
setModalIsOpen(false);

toast.success(t('successfulCreation') as string);
Expand Down Expand Up @@ -290,6 +292,18 @@ const OrgActionItemCategories = (): JSX.Element => {
setName(e.target.value);
}}
/>

{/* Toggle for Disabled Status */}
<Form.Check
className="mt-3"
type="switch"
id="disabledStatusToggle"
label={'disabledStatus'}
checked={disabledStatus}
onChange={(e): void => setDisabledStatus(e.target.checked)}

Check warning on line 303 in src/components/OrgActionItemCategories/OrgActionItemCategories.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/OrgActionItemCategories/OrgActionItemCategories.tsx#L303

Added line #L303 was not covered by tests
data-testid="disabledStatusToggle"
/>

<Button
type="submit"
className={styles.greenregbtn}
Expand Down

0 comments on commit c5ccf4e

Please sign in to comment.