-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ SESSION_SECRET="super-duper-s3cret" | |
HONEYPOT_SECRET="super-duper-s3cret" | ||
INTERNAL_COMMAND_TOKEN="some-made-up-token" | ||
RESEND_API_KEY="re_blAh_blaHBlaHblahBLAhBlAh" | ||
RESEND_EMAIL_ADDRESS="[email protected]" | ||
SENTRY_DSN="your-dsn" | ||
|
||
# the mocks and some code rely on these two being prefixed with "MOCK_" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ export async function sendEmail({ | |
| { html: string; text: string; react?: never } | ||
| { react: ReactElement; html?: never; text?: never } | ||
)) { | ||
const from = '[email protected]' | ||
const from = process.env.RESEND_EMAIL_ADDRESS | ||
|
||
const email = { | ||
from, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import { prisma } from '#app/utils/db.server.ts' | |
import { readEmail } from '#tests/mocks/utils.ts' | ||
import { createUser, expect, test as base } from '#tests/playwright-utils.ts' | ||
|
||
const RESEND_EMAIL_ADDRESS = process.env.RESEND_EMAIL_ADDRESS | ||
const URL_REGEX = /(?<url>https?:\/\/[^\s$.?#].[^\s]*)/ | ||
const CODE_REGEX = /Here's your verification code: (?<code>[\d\w]+)/ | ||
function extractUrl(text: string) { | ||
|
@@ -61,7 +62,7 @@ test('onboarding with link', async ({ page, getOnboardingData }) => { | |
const email = await readEmail(onboardingData.email) | ||
invariant(email, 'Email not found') | ||
expect(email.to).toBe(onboardingData.email.toLowerCase()) | ||
expect(email.from).toBe('[email protected]') | ||
expect(email.from).toBe(RESEND_EMAIL_ADDRESS) | ||
expect(email.subject).toMatch(/welcome/i) | ||
const onboardingUrl = extractUrl(email.text) | ||
invariant(onboardingUrl, 'Onboarding URL not found') | ||
|
@@ -121,7 +122,7 @@ test('onboarding with a short code', async ({ page, getOnboardingData }) => { | |
const email = await readEmail(onboardingData.email) | ||
invariant(email, 'Email not found') | ||
expect(email.to).toBe(onboardingData.email.toLowerCase()) | ||
expect(email.from).toBe('[email protected]') | ||
expect(email.from).toBe(RESEND_EMAIL_ADDRESS) | ||
expect(email.subject).toMatch(/welcome/i) | ||
const codeMatch = email.text.match(CODE_REGEX) | ||
const code = codeMatch?.groups?.code | ||
|
@@ -168,7 +169,7 @@ test('reset password with a link', async ({ page, insertNewUser }) => { | |
invariant(email, 'Email not found') | ||
expect(email.subject).toMatch(/password reset/i) | ||
expect(email.to).toBe(user.email.toLowerCase()) | ||
expect(email.from).toBe('[email protected]') | ||
expect(email.from).toBe(RESEND_EMAIL_ADDRESS) | ||
const resetPasswordUrl = extractUrl(email.text) | ||
invariant(resetPasswordUrl, 'Reset password URL not found') | ||
await page.goto(resetPasswordUrl) | ||
|
@@ -226,7 +227,7 @@ test('reset password with a short code', async ({ page, insertNewUser }) => { | |
invariant(email, 'Email not found') | ||
expect(email.subject).toMatch(/password reset/i) | ||
expect(email.to).toBe(user.email) | ||
expect(email.from).toBe('[email protected]') | ||
expect(email.from).toBe(RESEND_EMAIL_ADDRESS) | ||
const codeMatch = email.text.match(CODE_REGEX) | ||
const code = codeMatch?.groups?.code | ||
invariant(code, 'Reset Password code not found') | ||
|