From ecec515ed97928f8043da4e8bbaf23ae743c0427 Mon Sep 17 00:00:00 2001
From: Benedikt Magnus <magnus@magnuscraft.de>
Date: Thu, 4 Nov 2021 20:08:19 +0100
Subject: [PATCH] Fixed hasComponentOrigin in tests.

---
 tests/tests/messages/statefulCommands.ts | 13 +++++++++++++
 tests/utility/message.ts                 |  3 +++
 2 files changed, 16 insertions(+)

diff --git a/tests/tests/messages/statefulCommands.ts b/tests/tests/messages/statefulCommands.ts
index 5da4618..21628a6 100644
--- a/tests/tests/messages/statefulCommands.ts
+++ b/tests/tests/messages/statefulCommands.ts
@@ -72,6 +72,7 @@ describe('statefulCommands',
 
                 const message = new CommandTestMessage(database, testCallback, ChannelType.Personal);
                 message.content = Localisation.commands.yes.commands[0];
+                message.hasComponentOrigin = true;
 
                 message.prepareContact(State.Registration);
 
@@ -92,6 +93,7 @@ describe('statefulCommands',
 
                 const message = new CommandTestMessage(database, testCallback, ChannelType.Personal);
                 message.content = Localisation.commands.no.commands[0];
+                message.hasComponentOrigin = true;
 
                 message.prepareContact(State.Registration);
 
@@ -133,6 +135,7 @@ describe('statefulCommands',
 
                 const message = new CommandTestMessage(database, testCallback, ChannelType.Personal);
                 message.content = Localisation.commands.informationAnalogue.commands[0];
+                message.hasComponentOrigin = true;
 
                 message.prepareMember(State.InformationGiftTypeAsGiver);
 
@@ -154,6 +157,7 @@ describe('statefulCommands',
 
                 const message = new CommandTestMessage(database, testCallback, ChannelType.Personal);
                 message.content = Localisation.commands.informationDigital.commands[0];
+                message.hasComponentOrigin = true;
 
                 message.prepareMember(State.InformationGiftTypeAsGiver);
 
@@ -175,6 +179,7 @@ describe('statefulCommands',
 
                 const message = new CommandTestMessage(database, testCallback, ChannelType.Personal);
                 message.content = Localisation.commands.informationBothAnalogueAndDigital.commands[0];
+                message.hasComponentOrigin = true;
 
                 message.prepareMember(State.InformationGiftTypeAsGiver);
 
@@ -217,6 +222,7 @@ describe('statefulCommands',
 
                 const message = new CommandTestMessage(database, testCallback, ChannelType.Personal);
                 message.content = Localisation.commands.informationAnalogue.commands[0];
+                message.hasComponentOrigin = true;
 
                 message.prepareMember(State.InformationGiftTypeAsTaker);
 
@@ -238,6 +244,7 @@ describe('statefulCommands',
 
                 const message = new CommandTestMessage(database, testCallback, ChannelType.Personal);
                 message.content = Localisation.commands.informationDigital.commands[0];
+                message.hasComponentOrigin = true;
 
                 message.prepareMember(State.InformationGiftTypeAsTaker);
 
@@ -259,6 +266,7 @@ describe('statefulCommands',
 
                 const message = new CommandTestMessage(database, testCallback, ChannelType.Personal);
                 message.content = Localisation.commands.informationBothAnalogueAndDigital.commands[0];
+                message.hasComponentOrigin = true;
 
                 message.prepareMember(State.InformationGiftTypeAsTaker);
 
@@ -326,6 +334,7 @@ describe('statefulCommands',
 
                 const message = new CommandTestMessage(database, testCallback, ChannelType.Personal);
                 message.content = expectedCountry;
+                message.hasComponentOrigin = true;
 
                 const information = new Information('');
                 information.giftTypeAsTaker = GiftType.All;
@@ -352,6 +361,7 @@ describe('statefulCommands',
 
                 const message = new CommandTestMessage(database, testCallback, ChannelType.Personal);
                 message.content = expectedCountry;
+                message.hasComponentOrigin = true;
 
                 const information = new Information('');
                 information.giftTypeAsGiver = GiftType.All;
@@ -378,6 +388,7 @@ describe('statefulCommands',
 
                 const message = new CommandTestMessage(database, testCallback, ChannelType.Personal);
                 message.content = expectedCountry;
+                message.hasComponentOrigin = true;
 
                 const information = new Information('');
                 information.giftTypeAsTaker = GiftType.Analogue;
@@ -480,6 +491,7 @@ describe('statefulCommands',
 
                 const message = new CommandTestMessage(database, testCallback, ChannelType.Personal);
                 message.content = Localisation.commands.yes.commands[0];
+                message.hasComponentOrigin = true;
 
                 message.prepareMember(State.InformationInternationalAllowed);
 
@@ -501,6 +513,7 @@ describe('statefulCommands',
 
                 const message = new CommandTestMessage(database, testCallback, ChannelType.Personal);
                 message.content = Localisation.commands.no.commands[0];
+                message.hasComponentOrigin = true;
 
                 message.prepareMember(State.InformationInternationalAllowed);
 
diff --git a/tests/utility/message.ts b/tests/utility/message.ts
index fae169f..cc31484 100644
--- a/tests/utility/message.ts
+++ b/tests/utility/message.ts
@@ -17,12 +17,15 @@ export class TestMessage extends MessageWithParser implements Message
     public author: User;
     public channel: Channel;
     public client: Client;
+    public hasComponentOrigin: boolean;
     public reply: (text: string, components?: Component[], imageUrl?: string) => Promise<void>;
 
     constructor (reply: SendOrReplyFunction, userSend: SendOrReplyFunction, channelSend: SendOrReplyFunction, channelType: ChannelType)
     {
         super();
 
+        this.hasComponentOrigin = false;
+
         // TODO: Utility for author/client creation.
 
         this.content = GeneralTestUtility.createRandomString();
-- 
GitLab