import type { APIInteractionGuildMember, APIUser, InteractionType, LocaleString, Permissions, Snowflake } from 'discord-api-types/v10'; import { BaseInteractionType, ChatInputCommandInteraction, InGuild } from '../../../../../src'; import { ChatInputApplicationCommandInteractionData, makeResponse } from '../../../../shared'; describe('BaseInteraction', () => { const instance = new ChatInputCommandInteraction(makeResponse(), ChatInputApplicationCommandInteractionData); test('GIVEN replied THEN returns the raw data', () => { expect(instance.replied).toBe(false); }); test('GIVEN id THEN returns the raw data', () => { expect(instance.id).toBe(ChatInputApplicationCommandInteractionData.id); }); test('GIVEN type THEN returns the raw data', () => { expect(instance.type).toBe(ChatInputApplicationCommandInteractionData.type); }); test('GIVEN app_permissions THEN returns the raw data', () => { expect(instance.app_permissions).toBe(ChatInputApplicationCommandInteractionData.app_permissions); }); test('GIVEN applicationPermissions THEN returns the mapped data', () => { expect(instance.applicationPermissions).toBe(8n); }); test('GIVEN application_id THEN returns the raw data', () => { expect(instance.application_id).toBe(ChatInputApplicationCommandInteractionData.application_id); }); test('GIVEN applicationId THEN returns the raw data', () => { expect(instance.applicationId).toBe(ChatInputApplicationCommandInteractionData.application_id); }); test('GIVEN channel_id THEN returns the raw data', () => { expect(instance.channel_id).toBe(ChatInputApplicationCommandInteractionData.channel_id); }); test('GIVEN channelId THEN returns the raw data', () => { expect(instance.channelId).toBe(ChatInputApplicationCommandInteractionData.channel_id); }); test('GIVEN data THEN returns the raw data', () => { expect(instance.data).toBe(ChatInputApplicationCommandInteractionData.data); }); test('GIVEN guild_id THEN returns the raw data', () => { expect(instance.guild_id).toBe(ChatInputApplicationCommandInteractionData.guild_id); }); test('GIVEN guildId THEN returns the raw data', () => { expect(instance.guildId).toBe(ChatInputApplicationCommandInteractionData.guild_id); }); test('GIVEN guild_locale THEN returns the raw data', () => { expect(instance.guild_locale).toBe(ChatInputApplicationCommandInteractionData.guild_locale); }); test('GIVEN guildLocale THEN returns the raw data', () => { expect(instance.guildLocale).toBe(ChatInputApplicationCommandInteractionData.guild_locale); }); test('GIVEN locale THEN returns the raw data', () => { expect(instance.locale).toBe(ChatInputApplicationCommandInteractionData.locale); }); test('GIVEN member THEN returns the raw data', () => { expect(instance.member).toBe(ChatInputApplicationCommandInteractionData.member); }); test('GIVEN token THEN returns the raw data', () => { expect(instance.token).toBe(ChatInputApplicationCommandInteractionData.token); }); test('GIVEN user THEN returns the raw data', () => { expect(instance.user).toBe(ChatInputApplicationCommandInteractionData.member!.user); }); test('GIVEN version THEN returns the raw data', () => { expect<1>(instance.version).toBe(ChatInputApplicationCommandInteractionData.version); }); test('GIVEN inGuild in a guild interaction THEN returns true', () => { const value = instance.inGuild(); expect(value).toBe(true); if (value) { expect>(instance); expect(instance.guild_id); expect(instance.guildId); expect(instance.guild_locale); expect(instance.guildLocale); expect(instance.member); } else { expect(instance.guild_id); expect(instance.guildId); expect(instance.guild_locale); expect(instance.guildLocale); expect(instance.member); } }); describe.todo('fetchChannel'); describe.todo('fetchGuild'); });