From a8d60b0b057127b29931578aa2d00725e3489320 Mon Sep 17 00:00:00 2001 From: nerix Date: Fri, 18 Oct 2024 15:41:57 +0200 Subject: [PATCH] refactor: move MessageBuilder snapshot test to IrcMessageHandler (#5654) --- CHANGELOG.md | 2 +- src/providers/twitch/TwitchChannel.hpp | 4 ++-- tests/CMakeLists.txt | 2 +- .../IRC => IrcMessageHandler}/action.json | 0 .../all-usernames.json | 0 .../IRC => IrcMessageHandler}/bad-emotes.json | 0 .../IRC => IrcMessageHandler}/bad-emotes2.json | 0 .../IRC => IrcMessageHandler}/bad-emotes3.json | 0 .../IRC => IrcMessageHandler}/bad-emotes4.json | 0 .../badges-invalid.json | 0 .../IRC => IrcMessageHandler}/badges.json | 0 .../IRC => IrcMessageHandler}/blocked-user.json | 0 .../IRC => IrcMessageHandler}/cheer1.json | 0 .../IRC => IrcMessageHandler}/cheer2.json | 0 .../IRC => IrcMessageHandler}/cheer3.json | 0 .../IRC => IrcMessageHandler}/cheer4.json | 0 .../IRC => IrcMessageHandler}/custom-mod.json | 0 .../IRC => IrcMessageHandler}/custom-vip.json | 0 .../IRC => IrcMessageHandler}/emote-emoji.json | 0 .../IRC => IrcMessageHandler}/emote.json | 0 .../IRC => IrcMessageHandler}/emotes.json | 0 .../IRC => IrcMessageHandler}/emotes2.json | 0 .../IRC => IrcMessageHandler}/emotes3.json | 0 .../IRC => IrcMessageHandler}/emotes4.json | 0 .../IRC => IrcMessageHandler}/emotes5.json | 0 .../IRC => IrcMessageHandler}/first-msg.json | 0 .../IRC => IrcMessageHandler}/highlight1.json | 0 .../IRC => IrcMessageHandler}/highlight2.json | 0 .../IRC => IrcMessageHandler}/highlight3.json | 0 .../hype-chat-invalid.json | 0 .../IRC => IrcMessageHandler}/hype-chat0.json | 0 .../IRC => IrcMessageHandler}/hype-chat1.json | 0 .../IRC => IrcMessageHandler}/hype-chat2.json | 0 .../ignore-block1.json | 0 .../ignore-block2.json | 0 .../ignore-infinite.json | 0 .../ignore-replace.json | 0 .../IRC => IrcMessageHandler}/justinfan.json | 0 .../IRC => IrcMessageHandler}/links.json | 0 .../IRC => IrcMessageHandler}/mentions.json | 0 .../IRC => IrcMessageHandler}/mod.json | 0 .../IRC => IrcMessageHandler}/nickname.json | 0 .../IRC => IrcMessageHandler}/no-nick.json | 0 .../IRC => IrcMessageHandler}/no-tags.json | 0 .../redeemed-highlight.json | 0 .../IRC => IrcMessageHandler}/reply-action.json | 0 .../IRC => IrcMessageHandler}/reply-block.json | 0 .../reply-blocked-user.json | 0 .../IRC => IrcMessageHandler}/reply-child.json | 0 .../IRC => IrcMessageHandler}/reply-ignore.json | 0 .../reply-no-prev.json | 0 .../IRC => IrcMessageHandler}/reply-root.json | 0 .../IRC => IrcMessageHandler}/reply-single.json | 0 .../IRC => IrcMessageHandler}/reward-bits.json | 0 .../reward-blocked-user.json | 0 .../IRC => IrcMessageHandler}/reward-empty.json | 0 .../IRC => IrcMessageHandler}/reward-known.json | 0 .../reward-unknown.json | 0 .../IRC => IrcMessageHandler}/rm-deleted.json | 0 .../shared-chat-emotes.json | 0 .../shared-chat-known.json | 0 .../shared-chat-same-channel.json | 0 .../shared-chat-unknown.json | 0 .../IRC => IrcMessageHandler}/simple.json | 0 .../username-localized.json | 0 .../username-localized2.json | 0 .../IRC => IrcMessageHandler}/username.json | 0 .../IRC => IrcMessageHandler}/vip.json | 0 ...MessageBuilder.cpp => IrcMessageHandler.cpp} | 17 ++++++++--------- 69 files changed, 12 insertions(+), 13 deletions(-) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/action.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/all-usernames.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/bad-emotes.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/bad-emotes2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/bad-emotes3.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/bad-emotes4.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/badges-invalid.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/badges.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/blocked-user.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/cheer1.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/cheer2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/cheer3.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/cheer4.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/custom-mod.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/custom-vip.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emote-emoji.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emote.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emotes.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emotes2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emotes3.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emotes4.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/emotes5.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/first-msg.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/highlight1.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/highlight2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/highlight3.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/hype-chat-invalid.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/hype-chat0.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/hype-chat1.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/hype-chat2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/ignore-block1.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/ignore-block2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/ignore-infinite.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/ignore-replace.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/justinfan.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/links.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/mentions.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/mod.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/nickname.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/no-nick.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/no-tags.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/redeemed-highlight.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-action.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-block.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-blocked-user.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-child.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-ignore.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-no-prev.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-root.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reply-single.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reward-bits.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reward-blocked-user.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reward-empty.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reward-known.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/reward-unknown.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/rm-deleted.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/shared-chat-emotes.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/shared-chat-known.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/shared-chat-same-channel.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/shared-chat-unknown.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/simple.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/username-localized.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/username-localized2.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/username.json (100%) rename tests/snapshots/{MessageBuilder/IRC => IrcMessageHandler}/vip.json (100%) rename tests/src/{MessageBuilder.cpp => IrcMessageHandler.cpp} (97%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54544119b..fc73acb32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -103,7 +103,7 @@ - Dev: Added more tests for input completion. (#5604) - Dev: Refactored legacy Unicode zero-width-joiner replacement. (#5594) - Dev: The JSON output when copying a message (SHIFT + right-click) is now more extensive. (#5600) -- Dev: Added more tests for message building. (#5598) +- Dev: Added more tests for message building. (#5598, #5654) - Dev: Twitch messages are now sent using Twitch's Helix API instead of IRC by default. (#5607) - Dev: `GIFTimer` is no longer initialized in tests. (#5608) - Dev: Emojis now use flags instead of a set of strings for capabilities. (#5616) diff --git a/src/providers/twitch/TwitchChannel.hpp b/src/providers/twitch/TwitchChannel.hpp index 802da8112..41eb53de8 100644 --- a/src/providers/twitch/TwitchChannel.hpp +++ b/src/providers/twitch/TwitchChannel.hpp @@ -25,7 +25,7 @@ #include #include -class TestMessageBuilderP; +class TestIrcMessageHandlerP; namespace chatterino { @@ -464,7 +464,7 @@ private: friend class MessageBuilder; friend class IrcMessageHandler; friend class Commands_E2E_Test; - friend class ::TestMessageBuilderP; + friend class ::TestIrcMessageHandlerP; }; } // namespace chatterino diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 8a6647fee..5a2cb5f1b 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -22,7 +22,7 @@ set(test_SOURCES ${CMAKE_CURRENT_LIST_DIR}/src/UtilTwitch.cpp ${CMAKE_CURRENT_LIST_DIR}/src/IrcHelpers.cpp ${CMAKE_CURRENT_LIST_DIR}/src/TwitchPubSubClient.cpp - ${CMAKE_CURRENT_LIST_DIR}/src/MessageBuilder.cpp + ${CMAKE_CURRENT_LIST_DIR}/src/IrcMessageHandler.cpp ${CMAKE_CURRENT_LIST_DIR}/src/HighlightController.cpp ${CMAKE_CURRENT_LIST_DIR}/src/FormatTime.cpp ${CMAKE_CURRENT_LIST_DIR}/src/LimitedQueue.cpp diff --git a/tests/snapshots/MessageBuilder/IRC/action.json b/tests/snapshots/IrcMessageHandler/action.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/action.json rename to tests/snapshots/IrcMessageHandler/action.json diff --git a/tests/snapshots/MessageBuilder/IRC/all-usernames.json b/tests/snapshots/IrcMessageHandler/all-usernames.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/all-usernames.json rename to tests/snapshots/IrcMessageHandler/all-usernames.json diff --git a/tests/snapshots/MessageBuilder/IRC/bad-emotes.json b/tests/snapshots/IrcMessageHandler/bad-emotes.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/bad-emotes.json rename to tests/snapshots/IrcMessageHandler/bad-emotes.json diff --git a/tests/snapshots/MessageBuilder/IRC/bad-emotes2.json b/tests/snapshots/IrcMessageHandler/bad-emotes2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/bad-emotes2.json rename to tests/snapshots/IrcMessageHandler/bad-emotes2.json diff --git a/tests/snapshots/MessageBuilder/IRC/bad-emotes3.json b/tests/snapshots/IrcMessageHandler/bad-emotes3.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/bad-emotes3.json rename to tests/snapshots/IrcMessageHandler/bad-emotes3.json diff --git a/tests/snapshots/MessageBuilder/IRC/bad-emotes4.json b/tests/snapshots/IrcMessageHandler/bad-emotes4.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/bad-emotes4.json rename to tests/snapshots/IrcMessageHandler/bad-emotes4.json diff --git a/tests/snapshots/MessageBuilder/IRC/badges-invalid.json b/tests/snapshots/IrcMessageHandler/badges-invalid.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/badges-invalid.json rename to tests/snapshots/IrcMessageHandler/badges-invalid.json diff --git a/tests/snapshots/MessageBuilder/IRC/badges.json b/tests/snapshots/IrcMessageHandler/badges.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/badges.json rename to tests/snapshots/IrcMessageHandler/badges.json diff --git a/tests/snapshots/MessageBuilder/IRC/blocked-user.json b/tests/snapshots/IrcMessageHandler/blocked-user.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/blocked-user.json rename to tests/snapshots/IrcMessageHandler/blocked-user.json diff --git a/tests/snapshots/MessageBuilder/IRC/cheer1.json b/tests/snapshots/IrcMessageHandler/cheer1.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/cheer1.json rename to tests/snapshots/IrcMessageHandler/cheer1.json diff --git a/tests/snapshots/MessageBuilder/IRC/cheer2.json b/tests/snapshots/IrcMessageHandler/cheer2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/cheer2.json rename to tests/snapshots/IrcMessageHandler/cheer2.json diff --git a/tests/snapshots/MessageBuilder/IRC/cheer3.json b/tests/snapshots/IrcMessageHandler/cheer3.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/cheer3.json rename to tests/snapshots/IrcMessageHandler/cheer3.json diff --git a/tests/snapshots/MessageBuilder/IRC/cheer4.json b/tests/snapshots/IrcMessageHandler/cheer4.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/cheer4.json rename to tests/snapshots/IrcMessageHandler/cheer4.json diff --git a/tests/snapshots/MessageBuilder/IRC/custom-mod.json b/tests/snapshots/IrcMessageHandler/custom-mod.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/custom-mod.json rename to tests/snapshots/IrcMessageHandler/custom-mod.json diff --git a/tests/snapshots/MessageBuilder/IRC/custom-vip.json b/tests/snapshots/IrcMessageHandler/custom-vip.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/custom-vip.json rename to tests/snapshots/IrcMessageHandler/custom-vip.json diff --git a/tests/snapshots/MessageBuilder/IRC/emote-emoji.json b/tests/snapshots/IrcMessageHandler/emote-emoji.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emote-emoji.json rename to tests/snapshots/IrcMessageHandler/emote-emoji.json diff --git a/tests/snapshots/MessageBuilder/IRC/emote.json b/tests/snapshots/IrcMessageHandler/emote.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emote.json rename to tests/snapshots/IrcMessageHandler/emote.json diff --git a/tests/snapshots/MessageBuilder/IRC/emotes.json b/tests/snapshots/IrcMessageHandler/emotes.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emotes.json rename to tests/snapshots/IrcMessageHandler/emotes.json diff --git a/tests/snapshots/MessageBuilder/IRC/emotes2.json b/tests/snapshots/IrcMessageHandler/emotes2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emotes2.json rename to tests/snapshots/IrcMessageHandler/emotes2.json diff --git a/tests/snapshots/MessageBuilder/IRC/emotes3.json b/tests/snapshots/IrcMessageHandler/emotes3.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emotes3.json rename to tests/snapshots/IrcMessageHandler/emotes3.json diff --git a/tests/snapshots/MessageBuilder/IRC/emotes4.json b/tests/snapshots/IrcMessageHandler/emotes4.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emotes4.json rename to tests/snapshots/IrcMessageHandler/emotes4.json diff --git a/tests/snapshots/MessageBuilder/IRC/emotes5.json b/tests/snapshots/IrcMessageHandler/emotes5.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/emotes5.json rename to tests/snapshots/IrcMessageHandler/emotes5.json diff --git a/tests/snapshots/MessageBuilder/IRC/first-msg.json b/tests/snapshots/IrcMessageHandler/first-msg.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/first-msg.json rename to tests/snapshots/IrcMessageHandler/first-msg.json diff --git a/tests/snapshots/MessageBuilder/IRC/highlight1.json b/tests/snapshots/IrcMessageHandler/highlight1.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/highlight1.json rename to tests/snapshots/IrcMessageHandler/highlight1.json diff --git a/tests/snapshots/MessageBuilder/IRC/highlight2.json b/tests/snapshots/IrcMessageHandler/highlight2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/highlight2.json rename to tests/snapshots/IrcMessageHandler/highlight2.json diff --git a/tests/snapshots/MessageBuilder/IRC/highlight3.json b/tests/snapshots/IrcMessageHandler/highlight3.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/highlight3.json rename to tests/snapshots/IrcMessageHandler/highlight3.json diff --git a/tests/snapshots/MessageBuilder/IRC/hype-chat-invalid.json b/tests/snapshots/IrcMessageHandler/hype-chat-invalid.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/hype-chat-invalid.json rename to tests/snapshots/IrcMessageHandler/hype-chat-invalid.json diff --git a/tests/snapshots/MessageBuilder/IRC/hype-chat0.json b/tests/snapshots/IrcMessageHandler/hype-chat0.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/hype-chat0.json rename to tests/snapshots/IrcMessageHandler/hype-chat0.json diff --git a/tests/snapshots/MessageBuilder/IRC/hype-chat1.json b/tests/snapshots/IrcMessageHandler/hype-chat1.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/hype-chat1.json rename to tests/snapshots/IrcMessageHandler/hype-chat1.json diff --git a/tests/snapshots/MessageBuilder/IRC/hype-chat2.json b/tests/snapshots/IrcMessageHandler/hype-chat2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/hype-chat2.json rename to tests/snapshots/IrcMessageHandler/hype-chat2.json diff --git a/tests/snapshots/MessageBuilder/IRC/ignore-block1.json b/tests/snapshots/IrcMessageHandler/ignore-block1.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/ignore-block1.json rename to tests/snapshots/IrcMessageHandler/ignore-block1.json diff --git a/tests/snapshots/MessageBuilder/IRC/ignore-block2.json b/tests/snapshots/IrcMessageHandler/ignore-block2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/ignore-block2.json rename to tests/snapshots/IrcMessageHandler/ignore-block2.json diff --git a/tests/snapshots/MessageBuilder/IRC/ignore-infinite.json b/tests/snapshots/IrcMessageHandler/ignore-infinite.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/ignore-infinite.json rename to tests/snapshots/IrcMessageHandler/ignore-infinite.json diff --git a/tests/snapshots/MessageBuilder/IRC/ignore-replace.json b/tests/snapshots/IrcMessageHandler/ignore-replace.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/ignore-replace.json rename to tests/snapshots/IrcMessageHandler/ignore-replace.json diff --git a/tests/snapshots/MessageBuilder/IRC/justinfan.json b/tests/snapshots/IrcMessageHandler/justinfan.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/justinfan.json rename to tests/snapshots/IrcMessageHandler/justinfan.json diff --git a/tests/snapshots/MessageBuilder/IRC/links.json b/tests/snapshots/IrcMessageHandler/links.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/links.json rename to tests/snapshots/IrcMessageHandler/links.json diff --git a/tests/snapshots/MessageBuilder/IRC/mentions.json b/tests/snapshots/IrcMessageHandler/mentions.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/mentions.json rename to tests/snapshots/IrcMessageHandler/mentions.json diff --git a/tests/snapshots/MessageBuilder/IRC/mod.json b/tests/snapshots/IrcMessageHandler/mod.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/mod.json rename to tests/snapshots/IrcMessageHandler/mod.json diff --git a/tests/snapshots/MessageBuilder/IRC/nickname.json b/tests/snapshots/IrcMessageHandler/nickname.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/nickname.json rename to tests/snapshots/IrcMessageHandler/nickname.json diff --git a/tests/snapshots/MessageBuilder/IRC/no-nick.json b/tests/snapshots/IrcMessageHandler/no-nick.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/no-nick.json rename to tests/snapshots/IrcMessageHandler/no-nick.json diff --git a/tests/snapshots/MessageBuilder/IRC/no-tags.json b/tests/snapshots/IrcMessageHandler/no-tags.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/no-tags.json rename to tests/snapshots/IrcMessageHandler/no-tags.json diff --git a/tests/snapshots/MessageBuilder/IRC/redeemed-highlight.json b/tests/snapshots/IrcMessageHandler/redeemed-highlight.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/redeemed-highlight.json rename to tests/snapshots/IrcMessageHandler/redeemed-highlight.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-action.json b/tests/snapshots/IrcMessageHandler/reply-action.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-action.json rename to tests/snapshots/IrcMessageHandler/reply-action.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-block.json b/tests/snapshots/IrcMessageHandler/reply-block.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-block.json rename to tests/snapshots/IrcMessageHandler/reply-block.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-blocked-user.json b/tests/snapshots/IrcMessageHandler/reply-blocked-user.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-blocked-user.json rename to tests/snapshots/IrcMessageHandler/reply-blocked-user.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-child.json b/tests/snapshots/IrcMessageHandler/reply-child.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-child.json rename to tests/snapshots/IrcMessageHandler/reply-child.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-ignore.json b/tests/snapshots/IrcMessageHandler/reply-ignore.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-ignore.json rename to tests/snapshots/IrcMessageHandler/reply-ignore.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-no-prev.json b/tests/snapshots/IrcMessageHandler/reply-no-prev.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-no-prev.json rename to tests/snapshots/IrcMessageHandler/reply-no-prev.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-root.json b/tests/snapshots/IrcMessageHandler/reply-root.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-root.json rename to tests/snapshots/IrcMessageHandler/reply-root.json diff --git a/tests/snapshots/MessageBuilder/IRC/reply-single.json b/tests/snapshots/IrcMessageHandler/reply-single.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reply-single.json rename to tests/snapshots/IrcMessageHandler/reply-single.json diff --git a/tests/snapshots/MessageBuilder/IRC/reward-bits.json b/tests/snapshots/IrcMessageHandler/reward-bits.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reward-bits.json rename to tests/snapshots/IrcMessageHandler/reward-bits.json diff --git a/tests/snapshots/MessageBuilder/IRC/reward-blocked-user.json b/tests/snapshots/IrcMessageHandler/reward-blocked-user.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reward-blocked-user.json rename to tests/snapshots/IrcMessageHandler/reward-blocked-user.json diff --git a/tests/snapshots/MessageBuilder/IRC/reward-empty.json b/tests/snapshots/IrcMessageHandler/reward-empty.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reward-empty.json rename to tests/snapshots/IrcMessageHandler/reward-empty.json diff --git a/tests/snapshots/MessageBuilder/IRC/reward-known.json b/tests/snapshots/IrcMessageHandler/reward-known.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reward-known.json rename to tests/snapshots/IrcMessageHandler/reward-known.json diff --git a/tests/snapshots/MessageBuilder/IRC/reward-unknown.json b/tests/snapshots/IrcMessageHandler/reward-unknown.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/reward-unknown.json rename to tests/snapshots/IrcMessageHandler/reward-unknown.json diff --git a/tests/snapshots/MessageBuilder/IRC/rm-deleted.json b/tests/snapshots/IrcMessageHandler/rm-deleted.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/rm-deleted.json rename to tests/snapshots/IrcMessageHandler/rm-deleted.json diff --git a/tests/snapshots/MessageBuilder/IRC/shared-chat-emotes.json b/tests/snapshots/IrcMessageHandler/shared-chat-emotes.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/shared-chat-emotes.json rename to tests/snapshots/IrcMessageHandler/shared-chat-emotes.json diff --git a/tests/snapshots/MessageBuilder/IRC/shared-chat-known.json b/tests/snapshots/IrcMessageHandler/shared-chat-known.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/shared-chat-known.json rename to tests/snapshots/IrcMessageHandler/shared-chat-known.json diff --git a/tests/snapshots/MessageBuilder/IRC/shared-chat-same-channel.json b/tests/snapshots/IrcMessageHandler/shared-chat-same-channel.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/shared-chat-same-channel.json rename to tests/snapshots/IrcMessageHandler/shared-chat-same-channel.json diff --git a/tests/snapshots/MessageBuilder/IRC/shared-chat-unknown.json b/tests/snapshots/IrcMessageHandler/shared-chat-unknown.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/shared-chat-unknown.json rename to tests/snapshots/IrcMessageHandler/shared-chat-unknown.json diff --git a/tests/snapshots/MessageBuilder/IRC/simple.json b/tests/snapshots/IrcMessageHandler/simple.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/simple.json rename to tests/snapshots/IrcMessageHandler/simple.json diff --git a/tests/snapshots/MessageBuilder/IRC/username-localized.json b/tests/snapshots/IrcMessageHandler/username-localized.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/username-localized.json rename to tests/snapshots/IrcMessageHandler/username-localized.json diff --git a/tests/snapshots/MessageBuilder/IRC/username-localized2.json b/tests/snapshots/IrcMessageHandler/username-localized2.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/username-localized2.json rename to tests/snapshots/IrcMessageHandler/username-localized2.json diff --git a/tests/snapshots/MessageBuilder/IRC/username.json b/tests/snapshots/IrcMessageHandler/username.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/username.json rename to tests/snapshots/IrcMessageHandler/username.json diff --git a/tests/snapshots/MessageBuilder/IRC/vip.json b/tests/snapshots/IrcMessageHandler/vip.json similarity index 100% rename from tests/snapshots/MessageBuilder/IRC/vip.json rename to tests/snapshots/IrcMessageHandler/vip.json diff --git a/tests/src/MessageBuilder.cpp b/tests/src/IrcMessageHandler.cpp similarity index 97% rename from tests/src/MessageBuilder.cpp rename to tests/src/IrcMessageHandler.cpp index 107d4023c..a80e928ef 100644 --- a/tests/src/MessageBuilder.cpp +++ b/tests/src/IrcMessageHandler.cpp @@ -1,4 +1,4 @@ -#include "messages/MessageBuilder.hpp" +#include "providers/twitch/IrcMessageHandler.hpp" #include "common/Literals.hpp" #include "controllers/accounts/AccountController.hpp" @@ -20,7 +20,6 @@ #include "providers/seventv/SeventvBadges.hpp" #include "providers/twitch/api/Helix.hpp" #include "providers/twitch/ChannelPointReward.hpp" -#include "providers/twitch/IrcMessageHandler.hpp" #include "providers/twitch/TwitchAccount.hpp" #include "providers/twitch/TwitchBadge.hpp" #include "providers/twitch/TwitchBadges.hpp" @@ -56,7 +55,7 @@ namespace { /// to generate an initial snapshot. Make sure to verify the output! constexpr bool UPDATE_SNAPSHOTS = false; -const QString IRC_CATEGORY = u"MessageBuilder/IRC"_s; +const QString IRC_CATEGORY = u"IrcMessageHandler"_s; class MockApplication : public mock::BaseApplication { @@ -447,12 +446,12 @@ QT_WARNING_POP } // namespace -class TestMessageBuilderP : public ::testing::TestWithParam +class TestIrcMessageHandlerP : public ::testing::TestWithParam { public: void SetUp() override { - auto param = TestMessageBuilderP::GetParam(); + auto param = TestIrcMessageHandlerP::GetParam(); this->snapshot = testlib::Snapshot::read(IRC_CATEGORY, param); this->mockApplication = @@ -558,7 +557,7 @@ public: /// `IrcMesssageHandler` to ensure the correct (or: "real") arguments to build /// messages. /// -/// Tests are contained in `tests/snapshots/MessageBuilder/IRC`. Fixtures +/// Tests are contained in `tests/snapshots/IrcMessageHandler`. Fixtures /// consist of an object with the keys `input`, `output`, `settings` (optional), /// and `params` (optional). /// @@ -569,7 +568,7 @@ public: /// - `prevMessages`: An array of past messages (used for replies) /// - `findAllUsernames`: A boolean controlling the equally named setting /// (default: false) -TEST_P(TestMessageBuilderP, Run) +TEST_P(TestIrcMessageHandlerP, Run) { auto channel = makeMockTwitchChannel(u"pajlada"_s, *snapshot); @@ -608,10 +607,10 @@ TEST_P(TestMessageBuilderP, Run) } INSTANTIATE_TEST_SUITE_P( - IrcMessage, TestMessageBuilderP, + IrcMessage, TestIrcMessageHandlerP, testing::ValuesIn(testlib::Snapshot::discover(IRC_CATEGORY))); -TEST(TestMessageBuilderP, Integrity) +TEST(TestIrcMessageHandlerP, Integrity) { ASSERT_FALSE(UPDATE_SNAPSHOTS); // make sure fixtures are actually tested }