Skip to content

Commit

Permalink
chore: test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
moshloop committed Nov 11, 2024
1 parent cbfb0ca commit 0276444
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ describe("DeleteAgentButton", () => {
expect(
await screen.findByText("Are you sure you want to delete agent?")
).toBeInTheDocument();
const confirmButton = screen.getByTestId("confirm-button");
const confirmButton = screen.getByTestId("confirm-button-Delete");
userEvent.click(confirmButton);
await waitFor(() => {
expect(onDeleted).toHaveBeenCalled();
Expand Down
22 changes: 19 additions & 3 deletions src/components/Notifications/NotificationTabsLinks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,27 @@ import { Link } from "react-router-dom";
import ConfigSidebar from "../Configs/Sidebar/ConfigSidebar";
import { ErrorBoundary } from "../ErrorBoundary";
import { AuthorizationAccessCheck } from "../Permissions/AuthorizationAccessCheck";
import { BsBell, BsBellSlash, BsBraces } from "react-icons/bs";

const tabLinks = [
{ label: "Notifications", path: "/notifications", key: "Notifications" },
{ label: "Rules", path: "/notifications/rules", key: "Rules" },
{ label: "Silences", path: "/notifications/silences", key: "Silences" }
{
label: "Notifications",
path: "/notifications",
key: "Notifications",
icon: <BsBell />
},
{
label: "Rules",
path: "/notifications/rules",
key: "Rules",
icon: <BsBraces />
},
{
label: "Silences",
path: "/notifications/silences",
key: "Silences",
icon: <BsBellSlash />
}
];

type NotificationTabsLinksProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default function NotificationSilenceForm({
onSuccess
});

const { mutate: deleteSilence, isLoading: isDeleting } = useMutation({
const { mutate: deleteSilence } = useMutation({
mutationFn: async (id: string) => {
const res = await deleteNotificationSilence(id);
return res.data;
Expand Down Expand Up @@ -106,6 +106,7 @@ export default function NotificationSilenceForm({

const submit = (
v: Partial<SilenceNotificationRequest>,
// @ts-ignore
formik: FormikBag
) => {
// Before submitting, we need to parse the date math expressions, if
Expand Down
14 changes: 7 additions & 7 deletions src/ui/AlertDialog/ConfirmationPromptDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ export function ConfirmationPromptDialog({
className="h-6 w-6 text-red-600"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
strokeWidth="1.5"
stroke="currentColor"
aria-hidden="true"
data-slot="icon"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
strokeLinecap="round"
strokeLinejoin="round"
d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"
></path>
</svg>
Expand All @@ -64,14 +64,14 @@ export function ConfirmationPromptDialog({
className="h-6 w-6 text-green-600"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
strokeWidth="1.5"
stroke="currentColor"
aria-hidden="true"
data-slot="icon"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
strokeLinecap="round"
strokeLinejoin="round"
d="m4.5 12.75 6 6 9-13.5"
></path>
</svg>
Expand Down Expand Up @@ -105,7 +105,7 @@ export function ConfirmationPromptDialog({
<button
className="btn-primary"
onClick={onConfirm}
data-testid="confirm-button"
data-testid={`confirm-button-${yesLabel}`}
>
{isLoading && (
<FaCircleNotch className="mr-1 inline animate-spin" />
Expand Down

0 comments on commit 0276444

Please sign in to comment.