mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2026-03-01 12:44:28 +00:00
* Avoid early html encoding for the remaining '=' * Make 'EMAIL_DEFAULT_SENDER' required env * Implement sender and recipient name on send e-mails nodemailer conform * Fix e-mail snapshots
71 lines
1.6 KiB
TypeScript
71 lines
1.6 KiB
TypeScript
import CONFIG from '@config/index'
|
|
|
|
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
|
|
|
|
// eslint-disable-next-line import/first
|
|
import { sendRegistrationMail } from './sendEmail'
|
|
|
|
describe('sendRegistrationMail', () => {
|
|
const data: {
|
|
name: string
|
|
email: string
|
|
nonce: string
|
|
locale: string
|
|
inviteCode?: string
|
|
} = {
|
|
name: 'Bob &"?@\\ Baumeister',
|
|
email: 'moderator@example.org',
|
|
nonce: '123456',
|
|
locale: 'en',
|
|
inviteCode: 'welcome',
|
|
}
|
|
|
|
describe('with invite code', () => {
|
|
describe('English', () => {
|
|
beforeEach(() => {
|
|
data.locale = 'en'
|
|
data.inviteCode = 'welcome'
|
|
})
|
|
|
|
it('renders correctly', async () => {
|
|
await expect(sendRegistrationMail(data)).resolves.toMatchSnapshot()
|
|
})
|
|
})
|
|
|
|
describe('German', () => {
|
|
beforeEach(() => {
|
|
data.locale = 'de'
|
|
data.inviteCode = 'welcome'
|
|
})
|
|
|
|
it('renders correctly', async () => {
|
|
await expect(sendRegistrationMail(data)).resolves.toMatchSnapshot()
|
|
})
|
|
})
|
|
})
|
|
|
|
describe('without invite code', () => {
|
|
describe('English', () => {
|
|
beforeEach(() => {
|
|
data.locale = 'en'
|
|
delete data.inviteCode
|
|
})
|
|
|
|
it('renders correctly', async () => {
|
|
await expect(sendRegistrationMail(data)).resolves.toMatchSnapshot()
|
|
})
|
|
})
|
|
|
|
describe('German', () => {
|
|
beforeEach(() => {
|
|
data.locale = 'de'
|
|
delete data.inviteCode
|
|
})
|
|
|
|
it('renders correctly', async () => {
|
|
await expect(sendRegistrationMail(data)).resolves.toMatchSnapshot()
|
|
})
|
|
})
|
|
})
|
|
})
|