()
| 12 | import { upsertServer } from '../src/server'; |
| 13 | |
| 14 | async function seedOne() { |
| 15 | const server = mockServerWithFlags({ |
| 16 | id: '402', |
| 17 | flags: { |
| 18 | anonymizeMessages: false, |
| 19 | considerAllMessagesPublic: true, |
| 20 | readTheRulesConsentEnabled: true, |
| 21 | }, |
| 22 | }); |
| 23 | const channel = mockChannelWithFlags(server, { |
| 24 | flags: { |
| 25 | indexingEnabled: true, |
| 26 | autoThreadEnabled: false, |
| 27 | forumGuidelinesConsentEnabled: false, |
| 28 | markSolutionEnabled: true, |
| 29 | sendMarkSolutionInstructionsInNewThreads: true, |
| 30 | }, |
| 31 | inviteCode: 'invite-code', |
| 32 | type: ChannelType.GuildForum, |
| 33 | }); |
| 34 | const thread = mockThread(channel, { |
| 35 | type: ChannelType.PublicThread, |
| 36 | }); |
| 37 | const account = mockDiscordAccount(); |
| 38 | const messagesToMock = 10; |
| 39 | const messages = Array.from({ length: messagesToMock }, (_, i) => |
| 40 | mockMessage(server, thread, account, { |
| 41 | id: (BigInt(thread.id) + BigInt(i)).toString(), |
| 42 | parentChannelId: channel.id, |
| 43 | }), |
| 44 | ); |
| 45 | await upsertServer({ |
| 46 | create: server, |
| 47 | update: server, |
| 48 | }); |
| 49 | await upsertChannel({ |
| 50 | create: channel, |
| 51 | update: channel, |
| 52 | }); |
| 53 | await upsertChannel({ |
| 54 | create: thread, |
| 55 | update: thread, |
| 56 | }); |
| 57 | await upsertDiscordAccount(account); |
| 58 | await upsertManyMessages(messages); |
| 59 | } |
| 60 | |
| 61 | async function seedTwo() { |
| 62 | const server = mockServerWithFlags({ |
no test coverage detected