From 72829799fb85a1bd632654a921cf065a8831b5ce Mon Sep 17 00:00:00 2001 From: Snazzah Date: Tue, 17 Sep 2024 09:09:01 -0500 Subject: [PATCH] fix(tests): fix tests not using defaults and polls --- test/structures/interfaces/commandContext.ts | 24 ++++++++++++------- .../structures/interfaces/componentContext.ts | 14 +++++------ .../interfaces/messageInteraction.ts | 6 +++-- .../interfaces/modalInteractionContext.ts | 4 ++-- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/test/structures/interfaces/commandContext.ts b/test/structures/interfaces/commandContext.ts index 330c6ecb..c904a376 100644 --- a/test/structures/interfaces/commandContext.ts +++ b/test/structures/interfaces/commandContext.ts @@ -38,8 +38,8 @@ describe('CommandContext', () => { done(); }, false, - false, - false, + undefined, + undefined, undefined ); @@ -48,21 +48,21 @@ describe('CommandContext', () => { }); describe('For an interaction with no options', () => { - const ctx = new CommandContext(creator, basicInteraction, noop, false, false, false, undefined); + const ctx = new CommandContext(creator, basicInteraction, noop, false, undefined, undefined, undefined); it('does not have options in the context', () => expect(ctx.options).to.deep.equal({})); it('does not have subcommands in the context', () => expect(ctx.subcommands).to.deep.equal([])); }); describe('For an interaction with options', () => { - const ctx = new CommandContext(creator, optionsInteraction, noop, false, false, false, undefined); + const ctx = new CommandContext(creator, optionsInteraction, noop, false, undefined, undefined, undefined); it('has options in the context', () => expect(ctx.options).to.deep.equal({ string: 'hi', int: 2, bool: true })); it('does not have subcommands in the context', () => expect(ctx.subcommands).to.deep.equal([])); }); describe('For an interaction with a sub-command', () => { - const ctx = new CommandContext(creator, subCommandInteraction, noop, false, false, false, undefined); + const ctx = new CommandContext(creator, subCommandInteraction, noop, false, undefined, undefined, undefined); it('has an empty options object within the sub-command', () => expect(ctx.options).to.deep.equal({ 'sub-command': {} })); @@ -70,7 +70,7 @@ describe('CommandContext', () => { }); describe('For an interaction with a sub-command group', () => { - const ctx = new CommandContext(creator, subCommandGroupInteraction, noop, false, false, false, undefined); + const ctx = new CommandContext(creator, subCommandGroupInteraction, noop, false, undefined, undefined, undefined); it('has an empty options object within the sub-command group', () => expect(ctx.options).to.deep.equal({ 'sub-command-group': { 'sub-command': {} } })); @@ -79,7 +79,15 @@ describe('CommandContext', () => { }); describe('For an interaction with a sub-command with options', () => { - const ctx = new CommandContext(creator, subCommandOptionsInteraction, noop, false, false, false, undefined); + const ctx = new CommandContext( + creator, + subCommandOptionsInteraction, + noop, + false, + undefined, + undefined, + undefined + ); it('has options within the sub-command', () => expect(ctx.options).to.deep.equal({ 'sub-command': { string: 'hi', int: 2, bool: true } })); @@ -87,7 +95,7 @@ describe('CommandContext', () => { }); it('assigns properties properly', async () => { - const ctx = new CommandContext(creator, basicInteraction, noop, false, false, false, undefined); + const ctx = new CommandContext(creator, basicInteraction, noop, false, undefined, undefined, undefined); await ctx.defer(); expect(ctx.users.size).to.equal(0); diff --git a/test/structures/interfaces/componentContext.ts b/test/structures/interfaces/componentContext.ts index 05719c6f..5e5e4372 100644 --- a/test/structures/interfaces/componentContext.ts +++ b/test/structures/interfaces/componentContext.ts @@ -36,7 +36,7 @@ describe('ComponentContext', () => { expect(treq.status).to.equal(200); done(); }, - false, + undefined, undefined ); @@ -45,7 +45,7 @@ describe('ComponentContext', () => { }); it('assigns properties properly', async () => { - const ctx = new ComponentContext(creator, basicMessageInteraction, noop, false, undefined); + const ctx = new ComponentContext(creator, basicMessageInteraction, noop, undefined, undefined); await ctx.acknowledge(); expect(ctx.message.id).to.equal(basicMessageInteraction.message.id); @@ -54,7 +54,7 @@ describe('ComponentContext', () => { }); it('assigns properties properly for select interactions', async () => { - const ctx = new ComponentContext(creator, selectMessageInteraction, noop, false, undefined); + const ctx = new ComponentContext(creator, selectMessageInteraction, noop, undefined, undefined); await ctx.acknowledge(); expect(ctx.message.id).to.equal(selectMessageInteraction.message.id); @@ -75,7 +75,7 @@ describe('ComponentContext', () => { }); expect(treq.status).to.equal(200); }, - false, + undefined, undefined ); expect(ctx.initiallyResponded).to.equal(false); @@ -85,7 +85,7 @@ describe('ComponentContext', () => { }); it('returns false when already responded', async () => { - const ctx = new ComponentContext(creator, basicMessageInteraction, noop, false, undefined); + const ctx = new ComponentContext(creator, basicMessageInteraction, noop, undefined, undefined); await ctx.acknowledge(); await expect(ctx.acknowledge()).to.eventually.equal(false); }); @@ -110,7 +110,7 @@ describe('ComponentContext', () => { }); expect(treq.status).to.equal(200); }, - false, + undefined, undefined ); expect(ctx.initiallyResponded).to.equal(false); @@ -119,7 +119,7 @@ describe('ComponentContext', () => { }); it('edits original message after acknowledging', async () => { - const ctx = new ComponentContext(creator, basicMessageInteraction, noop, false, undefined); + const ctx = new ComponentContext(creator, basicMessageInteraction, noop, undefined, undefined); const scope = editMessage(basicMessageInteraction.message.id, followUpMessage); await ctx.acknowledge(); diff --git a/test/structures/interfaces/messageInteraction.ts b/test/structures/interfaces/messageInteraction.ts index ea02a390..978ecddb 100644 --- a/test/structures/interfaces/messageInteraction.ts +++ b/test/structures/interfaces/messageInteraction.ts @@ -98,7 +98,8 @@ describe('MessageInteractionContext', () => { flags: undefined, tts: undefined, components: undefined, - attachments: undefined + attachments: undefined, + poll: undefined } }); expect(treq.status).to.equal(200); @@ -126,7 +127,8 @@ describe('MessageInteractionContext', () => { flags: InteractionResponseFlags.EPHEMERAL, tts: undefined, components: undefined, - attachments: undefined + attachments: undefined, + poll: undefined } }); expect(treq.status).to.equal(200); diff --git a/test/structures/interfaces/modalInteractionContext.ts b/test/structures/interfaces/modalInteractionContext.ts index e5dc2d18..d22d2728 100644 --- a/test/structures/interfaces/modalInteractionContext.ts +++ b/test/structures/interfaces/modalInteractionContext.ts @@ -25,7 +25,7 @@ describe('ModalInteractionContext', () => { expect(treq.status).to.equal(200); done(); }, - false, + undefined, undefined ); @@ -34,7 +34,7 @@ describe('ModalInteractionContext', () => { }); it('assigns properties properly', async () => { - const ctx = new ModalInteractionContext(creator, modalInteraction, noop, false, undefined); + const ctx = new ModalInteractionContext(creator, modalInteraction, noop, undefined, undefined); expect(ctx.values).to.deep.equal({ text: 'hi' }); expect(ctx.customID).to.equal('modal');