53 lines
2.3 KiB
TypeScript
53 lines
2.3 KiB
TypeScript
|
|
import { describe, expect, it } from 'vitest';
|
||
|
|
|
||
|
|
import { inquiryClientConfirmation } from '@/lib/email/templates/inquiry-client-confirmation';
|
||
|
|
import { contactFormClientConfirmation } from '@/lib/email/templates/contact-form-client-confirmation';
|
||
|
|
|
||
|
|
// Note: assert prose that spans an interpolation on the plain-text part — the
|
||
|
|
// React-Email HTML renderer inserts `<!-- -->` markers at value boundaries.
|
||
|
|
|
||
|
|
describe('inquiryClientConfirmation (berth)', () => {
|
||
|
|
it('mirrors the website copy for a specific berth + signs off as Sales', async () => {
|
||
|
|
const { subject, html, text } = await inquiryClientConfirmation({
|
||
|
|
firstName: 'Jane',
|
||
|
|
mooringNumber: 'D13',
|
||
|
|
contactEmail: 'sales@portnimara.com',
|
||
|
|
portName: 'Port Nimara',
|
||
|
|
});
|
||
|
|
expect(subject).toBe('Port Nimara — Thank You for Your Interest');
|
||
|
|
expect(text).toContain('Thank you for expressing interest in Berth D13');
|
||
|
|
expect(text).toContain('Our team has registered your interest');
|
||
|
|
expect(text).toContain('reach out to us at sales@portnimara.com');
|
||
|
|
expect(text).toContain('The Port Nimara Sales Team');
|
||
|
|
expect(html).toContain('sales@portnimara.com');
|
||
|
|
expect(html).not.toContain('Port Nimara CRM');
|
||
|
|
});
|
||
|
|
|
||
|
|
it('uses "a Berth" when no mooring is given', async () => {
|
||
|
|
const { text, html } = await inquiryClientConfirmation({
|
||
|
|
firstName: 'Jane',
|
||
|
|
mooringNumber: null,
|
||
|
|
contactEmail: 'sales@portnimara.com',
|
||
|
|
portName: 'Port Nimara',
|
||
|
|
});
|
||
|
|
expect(text).toContain('Thank you for expressing interest in a Berth');
|
||
|
|
expect(html).not.toContain('Port Nimara CRM');
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
describe('contactFormClientConfirmation', () => {
|
||
|
|
it('mirrors the website copy + signs off as the Port Nimara Team', async () => {
|
||
|
|
const { subject, html, text } = await contactFormClientConfirmation({
|
||
|
|
firstName: 'Bob',
|
||
|
|
contactEmail: 'hello@portnimara.com',
|
||
|
|
portName: 'Port Nimara',
|
||
|
|
});
|
||
|
|
expect(subject).toBe('Port Nimara — Thank You for Contacting Us');
|
||
|
|
expect(text).toContain('Thank you for contacting Port Nimara');
|
||
|
|
expect(text).toContain('We have received your message');
|
||
|
|
expect(text).toContain('reach out to us at hello@portnimara.com');
|
||
|
|
expect(text).toContain('The Port Nimara Team');
|
||
|
|
expect(html).not.toContain('Port Nimara CRM');
|
||
|
|
});
|
||
|
|
});
|