All files / client/src/views/admin adminService.ts

28.57% Statements 2/7
100% Branches 0/0
100% Functions 2/2
28.57% Lines 2/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28        356x       356x                                      
import { api } from "client/utils/api";
import { ApiEndpoint } from "shared/constants/apiEndpoints";
import { EmailNotificationTrigger } from "shared/types/emailNotification";
 
export const getSentryTest = async (): Promise<void> => {
  await api.get(ApiEndpoint.SENTRY_TEST);
};
 
export const postEmailTest = async (
  email: string,
  notificationType: EmailNotificationTrigger,
  programId: string,
): Promise<{ status: "error" | "success"; message: string }> => {
  try {
    await api.post(ApiEndpoint.EMAIL_TEST, {
      email,
      notificationType,
      programId,
    });
    return { status: "success", message: "Test email sent successfully" };
  } catch (error) {
    return {
      status: "error",
      message: `Failed to send test email: ${String(error)}`,
    };
  }
};