Skip to content

Commit

Permalink
Updating test to work with material icons and removing TODO comment a…
Browse files Browse the repository at this point in the history
…nd adding better support for admin entered GO arguments.
  • Loading branch information
dr-bizz committed Oct 31, 2024
1 parent 4a14bf5 commit d8fa224
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ const TestComponent: React.FC<AnnouncementActionProps> = ({
describe('AnnouncementAction', () => {
describe('Icon', () => {
it('initial', () => {
const { getByRole, queryByText } = render(
const { getByRole } = render(
<TestComponent actionStyle={ActionStyleEnum.Icon} />,
);

expect(queryByText('Contacts')).not.toBeInTheDocument();

const icon = getByRole('button', { name: 'Contacts' });
expect(icon.childNodes[0]).toHaveClass('material-icons');
userEvent.click(icon);
expect(handlePerformAction).toHaveBeenCalled();
});
Expand Down
6 changes: 4 additions & 2 deletions src/components/Announcements/Announcements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ const Announcement: React.FC = () => {
switch (action.action) {
case ActionEnum.Go:
if (action.args) {
// TODO - Migrate the data on production, to convert to "Go" args to be to the new MPDX URL format
push(`/accountLists/${accountListId}/${action.args}`);
const args = action.args.startsWith('/')
? action.args

Check warning on line 100 in src/components/Announcements/Announcements.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/Announcements/Announcements.tsx#L100

Added line #L100 was not covered by tests
: `/${action.args}`;
push(`/accountLists/${accountListId}${args}`);
}
break;
case ActionEnum.AppealCreate:
Expand Down

0 comments on commit d8fa224

Please sign in to comment.