({
message,
title,
author,
files,
mentions,
channel,
}: {
message: string;
title?: string;
author: SerializedUser;
files: UploadedFile[];
mentions: SerializedUser[];
channel: SerializedChannel;
})
| 41 | } |
| 42 | |
| 43 | export function createThreadImitation({ |
| 44 | message, |
| 45 | title, |
| 46 | author, |
| 47 | files, |
| 48 | mentions, |
| 49 | channel, |
| 50 | }: { |
| 51 | message: string; |
| 52 | title?: string; |
| 53 | author: SerializedUser; |
| 54 | files: UploadedFile[]; |
| 55 | mentions: SerializedUser[]; |
| 56 | channel: SerializedChannel; |
| 57 | }): SerializedThread { |
| 58 | const id = uuid(); |
| 59 | return { |
| 60 | id, |
| 61 | sentAt: new Date().toISOString(), |
| 62 | lastReplyAt: new Date().toISOString(), |
| 63 | messages: [ |
| 64 | { |
| 65 | id: 'imitation-message-id', |
| 66 | body: message, |
| 67 | sentAt: new Date().toISOString(), |
| 68 | usersId: 'imitation-user-id', |
| 69 | mentions, |
| 70 | attachments: files.map((file) => { |
| 71 | return { |
| 72 | name: file.id, |
| 73 | url: file.url, |
| 74 | }; |
| 75 | }), |
| 76 | reactions: [], |
| 77 | threadId: id, |
| 78 | externalId: null, |
| 79 | messageFormat: MessageFormat.LINEN, |
| 80 | author: { |
| 81 | id: author.id, |
| 82 | username: username(author.displayName), |
| 83 | displayName: author.displayName, |
| 84 | profileImageUrl: author.profileImageUrl, |
| 85 | externalUserId: author.externalUserId, |
| 86 | authsId: null, |
| 87 | role: author.role, |
| 88 | }, |
| 89 | }, |
| 90 | ], |
| 91 | messageCount: 1, |
| 92 | channel: { |
| 93 | id: '1', |
| 94 | channelName: channel.channelName, |
| 95 | hidden: channel.hidden, |
| 96 | default: channel.default, |
| 97 | landing: channel.landing, |
| 98 | readonly: channel.readonly, |
| 99 | accountId: null, |
| 100 | pages: null, |
no test coverage detected