Ocelot-Social/backend/src/emails/sendChatMessageMail.spec.ts
Ulf Gebhardt a0c205b379
feat(backend): file upload chat backend (#8657)
* Prepare image uploads in chat

* files instead of images

* Fix file type and query

* Add dummy data to resolver

* fix graphql types

* Fix file upload, remove unncessary code

* Re-add fetch

* Fix room order after sent message

* Update backend/src/graphql/queries/messageQuery.ts

* Move room to top of list when a message is received

* working prototype chat file upload

* remove console

* allow to upload all kinds of files

* multiple images

* revert changes in S3 Images

* tag mimetype

* accept any file

* lint fix

* remove snapshot flakyness

* remove whitelist test

* fix messages spec

* fix query

* more query fixes

* fix seed

* made message resolver tests independent

* lint

* started specc for attachments

* more tests & fixes

* fix empty room error

* remove console logs

* fix tests

* fix createRoom last Messsage error properly

* lint fixes

* reduce changeset

* simplify config check

* reduce changeset

* missing change

* allow speech capture

* Fix file download

* Implement proper download

---------

Co-authored-by: Maximilian Harz <maxharz@gmail.com>
2025-06-13 19:02:37 +00:00

93 lines
2.6 KiB
TypeScript

import CONFIG from '@config/index'
CONFIG.SUPPORT_EMAIL = 'devops@ocelot.social'
// eslint-disable-next-line import/first
import { sendChatMessageMail } from './sendEmail'
const senderUser = {
allowEmbedIframes: false,
createdAt: '2025-04-30T00:16:49.610Z',
deleted: false,
disabled: false,
emailNotificationsChatMessage: true,
emailNotificationsCommentOnObservedPost: true,
emailNotificationsFollowingUsers: true,
emailNotificationsGroupMemberJoined: true,
emailNotificationsGroupMemberLeft: true,
emailNotificationsGroupMemberRemoved: true,
emailNotificationsGroupMemberRoleChanged: true,
emailNotificationsMention: true,
emailNotificationsPostInGroup: true,
encryptedPassword: '$2b$10$n.WujXapJrvn498lS97MD.gn8QwjWI9xlf8ckEYYtMTOPadMidcbG',
id: 'chatSender',
locale: 'en',
name: 'chatSender',
role: 'user',
showShoutsPublicly: false,
slug: 'chatsender',
termsAndConditionsAgreedAt: '2019-08-01T10:47:19.212Z',
termsAndConditionsAgreedVersion: '0.0.1',
updatedAt: '2025-04-30T00:16:49.610Z',
}
const recipientUser = {
allowEmbedIframes: false,
createdAt: '2025-04-30T00:16:49.716Z',
deleted: false,
disabled: false,
emailNotificationsChatMessage: true,
emailNotificationsCommentOnObservedPost: true,
emailNotificationsFollowingUsers: true,
emailNotificationsGroupMemberJoined: true,
emailNotificationsGroupMemberLeft: true,
emailNotificationsGroupMemberRemoved: true,
emailNotificationsGroupMemberRoleChanged: true,
emailNotificationsMention: true,
emailNotificationsPostInGroup: true,
encryptedPassword: '$2b$10$KOrCHvEB5CM7D.P3VcX2z.pSSBZKZhPqHW/QKym6V1S6fiG..xtBq',
id: 'chatReceiver',
locale: 'en',
name: 'chatReceiver',
role: 'user',
showShoutsPublicly: false,
slug: 'chatreceiver',
termsAndConditionsAgreedAt: '2019-08-01T10:47:19.212Z',
termsAndConditionsAgreedVersion: '0.0.1',
updatedAt: '2025-04-30T00:16:49.716Z',
}
describe('sendChatMessageMail', () => {
describe('English', () => {
beforeEach(() => {
recipientUser.locale = 'en'
})
it('chat_message template', async () => {
await expect(
sendChatMessageMail({
email: 'user@example.org',
senderUser,
recipientUser,
}),
).resolves.toMatchSnapshot()
})
})
describe('German', () => {
beforeEach(() => {
recipientUser.locale = 'de'
})
it('chat_message template', async () => {
await expect(
sendChatMessageMail({
email: 'user@example.org',
senderUser,
recipientUser,
}),
).resolves.toMatchSnapshot()
})
})
})