From b12999af48bf4dcb45895337e78f47f9299e5e2d Mon Sep 17 00:00:00 2001 From: Awesome-E <54484616+Awesome-E@users.noreply.github.com> Date: Sun, 8 Sep 2024 02:18:03 -0700 Subject: [PATCH] Modify all tests to remove Deta references --- .jest/mock-deta.js | 11 ---- .../commands/chat-input/attendance.test.js | 8 +-- .../commands/chat-input/inviteroles.test.js | 24 +++---- .../commands/chat-input/leaderboard.test.js | 64 +++++++++---------- __tests__/commands/chat-input/points.test.js | 10 +-- __tests__/commands/chat-input/request.test.js | 10 +-- .../chat-input/single-post-channel.test.js | 24 +++---- 7 files changed, 70 insertions(+), 81 deletions(-) diff --git a/.jest/mock-deta.js b/.jest/mock-deta.js index b25852e..a6b9762 100644 --- a/.jest/mock-deta.js +++ b/.jest/mock-deta.js @@ -1,18 +1,8 @@ const { createDefaultSettings } = require('../src/listeners/config') -// const deta = require('deta') const mockBaseGet = jest.fn(id => createDefaultSettings({ id })) const mockBasePut = jest.fn() -// jest.mock('deta', () => ({ -// Deta: jest.fn(() => ({ -// Base: jest.fn(() => ({ -// get: (...args) => mockBaseGet(...args), -// put: (...args) => mockBasePut(...args) -// })) -// })) -// })) - jest.mock('../src/modules/database', () => ({ serverSettingsDB: { get: (...args) => mockBaseGet(...args), @@ -21,6 +11,5 @@ jest.mock('../src/modules/database', () => ({ })) module.exports = { - Base: { get: mockBaseGet, put: mockBasePut }, serverSettingsDB: { get: mockBaseGet, put: mockBasePut } } diff --git a/__tests__/commands/chat-input/attendance.test.js b/__tests__/commands/chat-input/attendance.test.js index e39049d..9509501 100644 --- a/__tests__/commands/chat-input/attendance.test.js +++ b/__tests__/commands/chat-input/attendance.test.js @@ -78,7 +78,7 @@ describe('Attendance Record Command', () => { guild.voiceStates.cache.set('1', createVoiceState(channel)) await recordAttendance(interaction, client) expect(guild.fetch).toBeCalled() - expect(detaMock.Base.put).toBeCalledWith(expectedConfig) + expect(detaMock.serverSettingsDB.put).toBeCalledWith(expectedConfig) }) }) @@ -95,7 +95,7 @@ describe('Attendance List Command', () => { const config = createDefaultSettings(guild) config.attendance = {} // Exists, but no events - detaMock.Base.get.mockReturnValue(config) + detaMock.serverSettingsDB.get.mockReturnValue(config) await listAttendance(this.interaction, client) expect(this.interaction.reply).toBeCalledWith(expectedReply) @@ -104,14 +104,14 @@ describe('Attendance List Command', () => { it('Replies with the correct counts when events exist', async () => { const config = createDefaultSettings(guild) config.attendance = { [today + ' \u2013 name']: ['user-id', 'u2'], 'Bad name': [] } - detaMock.Base.get.mockReturnValue(config) + detaMock.serverSettingsDB.get.mockReturnValue(config) const expectedReply = { content: `__**${today} \u2013 name:**__ 2\n__**Bad name:**__ 0` } await listAttendance(this.interaction, client) expect(this.interaction.reply).toBeCalledWith(expectedReply) config.attendance = { 'Empty Only': [] } - detaMock.Base.get.mockReturnValue(config) + detaMock.serverSettingsDB.get.mockReturnValue(config) const expected2 = { content: '__**Empty Only:**__ 0' } await listAttendance(this.interaction, client) diff --git a/__tests__/commands/chat-input/inviteroles.test.js b/__tests__/commands/chat-input/inviteroles.test.js index 121cb0a..ff6e224 100644 --- a/__tests__/commands/chat-input/inviteroles.test.js +++ b/__tests__/commands/chat-input/inviteroles.test.js @@ -18,7 +18,7 @@ guild.invites.fetch.mockImplementation(async () => guild.invites.cache) const invite = discordMock.createInvite(client, { channel, guild, code: 'INV', id: '11' }, guild) guild.invites.cache.set(invite.id, invite) -detaMock.Base.get.mockReturnValue({ inviteRoles: [] }) +detaMock.serverSettingsDB.get.mockReturnValue({ inviteRoles: [] }) const permissions = PermissionFlagsBits.ViewChannel const role = discordMock.createRole(client, { name: 'ten', id: '10', permissions }, guild) @@ -108,7 +108,7 @@ describe('Inviteroles add command', () => { }) it('Replies with an error if the rule already exists', async () => { - detaMock.Base.get.mockReturnValueOnce({ inviteRoles: [{ name: 'tens' }] }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ inviteRoles: [{ name: 'tens' }] }) const expectedReply = { embeds: [{ color: 0xff0000, @@ -159,7 +159,7 @@ describe('Inviteroles add command', () => { updated_at: 1234 } await addInviteRule(this.interaction, client, false) - expect(detaMock.Base.put).toBeCalledWith({ inviteRoles: [expectedConfig] }) + expect(detaMock.serverSettingsDB.put).toBeCalledWith({ inviteRoles: [expectedConfig] }) }) }) @@ -188,7 +188,7 @@ describe('Inviteroles details command', () => { expect(this.interaction.reply).toBeCalledWith(expectedNoMatchReply) this.interaction.reply.mockClear() - detaMock.Base.get.mockReturnValueOnce({ inviteRoles: [] }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ inviteRoles: [] }) delete this.options.name const expectedNoRulesReply = { content: 'Details of all role assignments:', @@ -203,7 +203,7 @@ describe('Inviteroles details command', () => { }) it('Replies with all invite role assignment rules if no name is specified', async () => { - detaMock.Base.get.mockReturnValueOnce({ inviteRoles: [] }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ inviteRoles: [] }) this.options = { name: 'tens', rename: 'ten-people', @@ -252,7 +252,7 @@ describe('Inviteroles delete command', () => { }) it('Replies with an error if that invite role assignment does not exist', async () => { - detaMock.Base.get.mockReturnValueOnce({ inviteRoles: [] }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ inviteRoles: [] }) const expectedNoMatchReply = { embeds: [{ color: 0xff0000, @@ -267,7 +267,7 @@ describe('Inviteroles delete command', () => { }) it('Replies with the rule that was deleted', async () => { - detaMock.Base.get.mockReturnValueOnce({ inviteRoles: [this.rule] }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ inviteRoles: [this.rule] }) const expectedNoMatchReply = { embeds: [{ title: 'Deleted `tens`', @@ -284,9 +284,9 @@ describe('Inviteroles delete command', () => { }) it('Removees the role assigment rule from the database', async () => { - detaMock.Base.get.mockReturnValueOnce({ inviteRoles: [this.rule] }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ inviteRoles: [this.rule] }) await removeInviteRule(this.interaction, client) - expect(detaMock.Base.put).toBeCalledWith({ inviteRoles: [] }) + expect(detaMock.serverSettingsDB.put).toBeCalledWith({ inviteRoles: [] }) }) }) @@ -318,7 +318,7 @@ describe('Inviteroles update command', () => { invites: invite.code } this.interaction.reply.mockClear() - detaMock.Base.put.mockClear() + detaMock.serverSettingsDB.put.mockClear() }) it('Replies with an error if the rule name is invalid', async () => { @@ -419,7 +419,7 @@ describe('Inviteroles update command', () => { it('Updates the invite role assignment rule in the database', async () => { this.options['remove-roles'] = 'None' - detaMock.Base.get.mockReturnValueOnce({ inviteRoles: [this.rule] }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ inviteRoles: [this.rule] }) const expectedConfig = { name: 'ten-people', invites: ['INV'], @@ -432,6 +432,6 @@ describe('Inviteroles update command', () => { } this.interaction.reply.mockImplementation(x => console.log(x)) await addInviteRule(this.interaction, client, true) - expect(detaMock.Base.put).toBeCalledWith({ inviteRoles: [expectedConfig] }) + expect(detaMock.serverSettingsDB.put).toBeCalledWith({ inviteRoles: [expectedConfig] }) }) }) diff --git a/__tests__/commands/chat-input/leaderboard.test.js b/__tests__/commands/chat-input/leaderboard.test.js index 6f3804b..48d6d77 100644 --- a/__tests__/commands/chat-input/leaderboard.test.js +++ b/__tests__/commands/chat-input/leaderboard.test.js @@ -26,11 +26,11 @@ function testNonExistent (thisArg, fn) { content: 'No such leaderboard with name leaderboard exists', ephemeral: true } - detaMock.Base.get.mockReturnValue({}) + detaMock.serverSettingsDB.get.mockReturnValue({}) await fn(thisArg.interaction, client) expect(thisArg.interaction.reply).toBeCalledWith(expectedReply) - detaMock.Base.get.mockReturnValueOnce({ leaderboards: { blah: {} } }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ leaderboards: { blah: {} } }) await fn(thisArg.interaction, client) expect(thisArg.interaction.reply).toBeCalledWith(expectedReply) } @@ -42,9 +42,9 @@ describe('Leaderboard Create Command', () => { channel.send.mockReturnValue({ id: '1' }) }) beforeEach(() => { - detaMock.Base.get.mockClear() - detaMock.Base.put.mockReset() - detaMock.Base.get.mockReturnValue({}) + detaMock.serverSettingsDB.get.mockClear() + detaMock.serverSettingsDB.put.mockReset() + detaMock.serverSettingsDB.get.mockReturnValue({}) this.interaction.options.getString .mockReturnValueOnce('leaderboard') // Name .mockReturnValueOnce('Leaderboard') // Title @@ -53,7 +53,7 @@ describe('Leaderboard Create Command', () => { }) afterAll(() => { - detaMock.Base.get.mockReset() + detaMock.serverSettingsDB.get.mockReset() this.interaction.options.getSubcommand.mockClear() channel.send.mockClear() }) @@ -62,7 +62,7 @@ describe('Leaderboard Create Command', () => { }) it('Replies with an error if a leaderboard with that name already exists', async () => { - detaMock.Base.get.mockReturnValueOnce({ + detaMock.serverSettingsDB.get.mockReturnValueOnce({ leaderboards: { leaderboard: { title: 'test' } } }) await createLeaderboard(this.interaction, client) @@ -98,7 +98,7 @@ describe('Leaderboard Create Command', () => { } this.interaction.options.getChannel.mockReturnValueOnce(undefined) await createLeaderboard(this.interaction, client) - expect(detaMock.Base.put).toBeCalledWith(expectedDB) + expect(detaMock.serverSettingsDB.put).toBeCalledWith(expectedDB) }) it('Sends a message to the target channel if specified', async () => { @@ -130,7 +130,7 @@ describe('Leaderboard Create Command', () => { scores: {} } await createLeaderboard(this.interaction, client) - expect(detaMock.Base.put).toBeCalledWith(expectedDB) + expect(detaMock.serverSettingsDB.put).toBeCalledWith(expectedDB) }) }) @@ -140,14 +140,14 @@ describe('Leaderboard Delete Command', () => { channel.send.mockReturnValue({ id: '1' }) }) beforeEach(() => { - detaMock.Base.get.mockClear() - detaMock.Base.put.mockReset() - detaMock.Base.get.mockReturnValue({}) + detaMock.serverSettingsDB.get.mockClear() + detaMock.serverSettingsDB.put.mockReset() + detaMock.serverSettingsDB.get.mockReturnValue({}) this.interaction.options.getString.mockReturnValue('leaderboard') }) afterAll(() => { - detaMock.Base.get.mockReset() + detaMock.serverSettingsDB.get.mockReset() this.interaction.options.getSubcommand.mockClear() channel.send.mockClear() }) @@ -163,7 +163,7 @@ describe('Leaderboard Delete Command', () => { title: 'Leaderboard', type: 'user' } - detaMock.Base.get.mockReturnValueOnce({ leaderboards: { leaderboard } }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ leaderboards: { leaderboard } }) const expectedReply = { embeds: [{ title: 'Leaderboard Deleted: Leaderboard', @@ -184,10 +184,10 @@ describe('Leaderboard Delete Command', () => { title: 'Leaderboard', type: 'user' } - detaMock.Base.get.mockReturnValueOnce({ leaderboards: { leaderboard } }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ leaderboards: { leaderboard } }) await deleteLeaderboard(this.interaction, client) const expectedDB = { leaderboards: {} } - expect(detaMock.Base.put).toBeCalledWith(expectedDB) + expect(detaMock.serverSettingsDB.put).toBeCalledWith(expectedDB) }) it('Deletes the existing leaderboard post, if it exists', async () => { @@ -203,7 +203,7 @@ describe('Leaderboard Delete Command', () => { channelID: '2', messageID: '1' } - detaMock.Base.get.mockReturnValueOnce({ leaderboards: { leaderboard } }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ leaderboards: { leaderboard } }) await deleteLeaderboard(this.interaction, client) expect(delFn).toBeCalled() @@ -229,14 +229,14 @@ describe('Leaderboard Repost Command', () => { } }) beforeEach(() => { - detaMock.Base.get.mockClear() - detaMock.Base.put.mockReset() - detaMock.Base.get.mockReturnValue({ leaderboards: { leaderboard: this.leaderboard } }) + detaMock.serverSettingsDB.get.mockClear() + detaMock.serverSettingsDB.put.mockReset() + detaMock.serverSettingsDB.get.mockReturnValue({ leaderboards: { leaderboard: this.leaderboard } }) this.interaction.options.getString.mockReturnValue('leaderboard') }) afterAll(() => { - detaMock.Base.get.mockReset() + detaMock.serverSettingsDB.get.mockReset() this.interaction.options.getSubcommand.mockClear() channel.send.mockClear() }) @@ -290,7 +290,7 @@ describe('Leaderboard Repost Command', () => { scores: {} } await repostLeaderboard(this.interaction, client) - expect(detaMock.Base.put).toBeCalledWith(expectedDB) + expect(detaMock.serverSettingsDB.put).toBeCalledWith(expectedDB) }) }) @@ -306,14 +306,14 @@ describe('Leaderboard Reset Command', () => { } }) beforeEach(() => { - detaMock.Base.get.mockClear() - detaMock.Base.put.mockReset() - detaMock.Base.get.mockReturnValue({ leaderboards: { leaderboard: this.leaderboard } }) + detaMock.serverSettingsDB.get.mockClear() + detaMock.serverSettingsDB.put.mockReset() + detaMock.serverSettingsDB.get.mockReturnValue({ leaderboards: { leaderboard: this.leaderboard } }) this.interaction.options.getString.mockReturnValue('leaderboard') }) afterAll(() => { - detaMock.Base.get.mockReset() + detaMock.serverSettingsDB.get.mockReset() this.interaction.options.getSubcommand.mockReset() channel.send.mockClear() }) @@ -379,7 +379,7 @@ describe('Leaderboard Reset Command', () => { scores: {} } await resetLeaderboard(this.interaction, client) - expect(detaMock.Base.put).toBeCalledWith(expectedDB) + expect(detaMock.serverSettingsDB.put).toBeCalledWith(expectedDB) }) }) @@ -400,15 +400,15 @@ describe('Leaderboard Update Command (Post Leaderboards)', () => { } }) beforeEach(() => { - detaMock.Base.get.mockClear() - detaMock.Base.put.mockReset() - detaMock.Base.get.mockReturnValue({ leaderboards: { leaderboard: this.leaderboard } }) + detaMock.serverSettingsDB.get.mockClear() + detaMock.serverSettingsDB.put.mockReset() + detaMock.serverSettingsDB.get.mockReturnValue({ leaderboards: { leaderboard: this.leaderboard } }) this.interaction.options.getString.mockReturnValueOnce('leaderboard') // name this.leaderboard.scores = {} }) afterAll(() => { - detaMock.Base.get.mockReset() + detaMock.serverSettingsDB.get.mockReset() this.interaction.options.getSubcommand.mockClear() channel.send.mockClear() }) @@ -491,6 +491,6 @@ describe('Leaderboard Update Command (Post Leaderboards)', () => { } await updatePostsLeaderboard(this.interaction, client) - expect(detaMock.Base.put).toBeCalledWith(expectedDB) + expect(detaMock.serverSettingsDB.put).toBeCalledWith(expectedDB) }) }) diff --git a/__tests__/commands/chat-input/points.test.js b/__tests__/commands/chat-input/points.test.js index 8e3e067..43053de 100644 --- a/__tests__/commands/chat-input/points.test.js +++ b/__tests__/commands/chat-input/points.test.js @@ -22,12 +22,12 @@ describe('Points Command', () => { this.interaction.options.getChannel.mockReturnValue(channel) }) beforeEach(() => { - detaMock.Base.get.mockClear() - detaMock.Base.get.mockReturnValue({}) + detaMock.serverSettingsDB.get.mockClear() + detaMock.serverSettingsDB.get.mockReturnValue({}) }) afterEach(() => { - detaMock.Base.get.mockReset() + detaMock.serverSettingsDB.get.mockReset() this.interaction.reply.mockClear() }) @@ -50,7 +50,7 @@ describe('Points Command', () => { }) it('Returns the correct amount of points for each task', async () => { - detaMock.Base.get.mockReturnValue({ + detaMock.serverSettingsDB.get.mockReturnValue({ messageCounter: { counts: { u1: 1 } }, attendance: { event: ['u2'] }, // a different user leaderboards: { weekly: { scores: { u1: [] } } } // zero @@ -71,7 +71,7 @@ describe('Points Command', () => { await respondWithPoints(this.interaction, client) expect(this.interaction.reply).toBeCalledWith(expectedReply) - detaMock.Base.get.mockReturnValue({ + detaMock.serverSettingsDB.get.mockReturnValue({ messageCounter: { counts: { u1: 3 } }, attendance: { event: ['u1'] }, leaderboards: { weekly: { scores: { u1: [{}, {}] } } } // 2 posts of some sort diff --git a/__tests__/commands/chat-input/request.test.js b/__tests__/commands/chat-input/request.test.js index 22e8402..db4fee5 100644 --- a/__tests__/commands/chat-input/request.test.js +++ b/__tests__/commands/chat-input/request.test.js @@ -27,8 +27,8 @@ describe('Request Channel Command', () => { }) beforeEach(() => { this.interaction = discordMock.createInteraction(client, { guild, member }) - detaMock.Base.get.mockClear() - detaMock.Base.get.mockReturnValue({ + detaMock.serverSettingsDB.get.mockClear() + detaMock.serverSettingsDB.get.mockReturnValue({ alertsChannel: channel.id, channelRequest: { enabled: true } }) @@ -40,12 +40,12 @@ describe('Request Channel Command', () => { }) afterEach(() => { - detaMock.Base.get.mockReset() + detaMock.serverSettingsDB.get.mockReset() this.interaction.reply.mockClear() }) it('Replies with an error if channel requests are disabled', async () => { - detaMock.Base.get.mockReturnValueOnce({ channelRequest: { enabled: false } }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ channelRequest: { enabled: false } }) await makeChannelRequest(this.interaction, client) expect(this.interaction.reply).toBeCalledWith({ content: 'Unable to send request because requests have not been enabled', @@ -54,7 +54,7 @@ describe('Request Channel Command', () => { }) it('Replies with an error if there is no alerts channel', async () => { - detaMock.Base.get.mockReturnValueOnce({ channelRequest: { enabled: true } }) // no alertsChannel + detaMock.serverSettingsDB.get.mockReturnValueOnce({ channelRequest: { enabled: true } }) // no alertsChannel await makeChannelRequest(this.interaction, client) expect(this.interaction.reply).toBeCalledWith({ content: 'Unable to send request due to bad host configuration', diff --git a/__tests__/commands/chat-input/single-post-channel.test.js b/__tests__/commands/chat-input/single-post-channel.test.js index d686332..907d906 100644 --- a/__tests__/commands/chat-input/single-post-channel.test.js +++ b/__tests__/commands/chat-input/single-post-channel.test.js @@ -22,11 +22,11 @@ describe('Single Post Channel Add Command', () => { }) beforeEach(() => { this.interaction.reply.mockClear() - detaMock.Base.get.mockReturnValue({}) + detaMock.serverSettingsDB.get.mockReturnValue({}) }) it('Replies with an error if the channel is already a single-post channel', async () => { - detaMock.Base.get.mockReturnValueOnce({ singlePostChannels: [channel.id] }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ singlePostChannels: [channel.id] }) const expectedReply = { content: 'Channel is already a single-post channel', ephemeral: true } await setSPChannel(this.interaction, client, true) expect(this.interaction.reply).toBeCalledWith(expectedReply) @@ -41,7 +41,7 @@ describe('Single Post Channel Add Command', () => { it('Updates the DB with the newly added single-post channel ID', async () => { const expectedDB = { singlePostChannels: ['2'] } await setSPChannel(this.interaction, client, true) - expect(detaMock.Base.put).toBeCalledWith(expectedDB) + expect(detaMock.serverSettingsDB.put).toBeCalledWith(expectedDB) }) it('Emits an event that Single Post Channels were updated', async () => { @@ -56,7 +56,7 @@ describe('Single Post Channel Remove Command', () => { }) beforeEach(() => { this.interaction.reply.mockClear() - detaMock.Base.get.mockReturnValue({}) + detaMock.serverSettingsDB.get.mockReturnValue({}) }) it('Replies with an error if the channel is not a single-post channel', async () => { @@ -66,21 +66,21 @@ describe('Single Post Channel Remove Command', () => { }) it('Replies that the current channel is no longer a single-post channel', async () => { - detaMock.Base.get.mockReturnValueOnce({ singlePostChannels: [channel.id] }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ singlePostChannels: [channel.id] }) const expectedReply = { content: '<#2> is no longer a single-post channel', ephemeral: true } await setSPChannel(this.interaction, client, false) expect(this.interaction.reply).toBeCalledWith(expectedReply) }) it('Updates the DB with the newly removed single-post channel ID', async () => { - detaMock.Base.get.mockReturnValueOnce({ singlePostChannels: [channel.id, '3'] }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ singlePostChannels: [channel.id, '3'] }) const expectedDB = { singlePostChannels: ['3'] } await setSPChannel(this.interaction, client, false) - expect(detaMock.Base.put).toBeCalledWith(expectedDB) + expect(detaMock.serverSettingsDB.put).toBeCalledWith(expectedDB) }) it('Emits an event that Single Post Channels were updated', async () => { - detaMock.Base.get.mockReturnValueOnce({ singlePostChannels: [channel.id, '3'] }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ singlePostChannels: [channel.id, '3'] }) await setSPChannel(this.interaction, client, false) expect(client.emit).toBeCalledWith('*UpdateSinglePostChannels', 'g1', ['3']) }) @@ -92,11 +92,11 @@ describe('Single Post Channel Status Command', () => { }) beforeEach(() => { this.interaction.reply.mockClear() - detaMock.Base.get.mockReturnValue({}) + detaMock.serverSettingsDB.get.mockReturnValue({}) }) it('Replies that the channel is single-post when it is marked', async () => { - detaMock.Base.get.mockReturnValueOnce({ singlePostChannels: [channel.id] }) + detaMock.serverSettingsDB.get.mockReturnValueOnce({ singlePostChannels: [channel.id] }) const expectedReply = { content: '<#2> currently is a single-post channel', ephemeral: true } await getSPCStatus(this.interaction, client) expect(this.interaction.reply).toBeCalledWith(expectedReply) @@ -116,11 +116,11 @@ describe('Single Post Channel Grant Permissions Command', () => { }) beforeEach(() => { this.interaction.reply.mockClear() - detaMock.Base.get.mockReturnValue({ singlePostChannels: [channel.id] }) + detaMock.serverSettingsDB.get.mockReturnValue({ singlePostChannels: [channel.id] }) }) it('Replies with an error if the channel is not a single-post channel', async () => { - detaMock.Base.get.mockReturnValueOnce({}) + detaMock.serverSettingsDB.get.mockReturnValueOnce({}) const expectedReply = { content: 'Channel is not a single-post channel', ephemeral: true } await grantSendPermission(this.interaction, client) expect(this.interaction.reply).toBeCalledWith(expectedReply)