rallly/apps/web/tests/utils.ts
2025-01-31 16:54:41 +07:00

16 lines
374 B
TypeScript

import { load } from "cheerio";
import { captureEmailHTML } from "./mailpit/mailpit";
/**
* Get the 6-digit code from the email
* @param email The email address to get the code for
* @returns 6-digit code
*/
export const getCode = async (email: string) => {
const html = await captureEmailHTML(email);
const $ = load(html);
return $("#code").text().trim();
};