mirror of
https://github.com/TheRealOwenRees/plantid-discord-bot.git
synced 2026-07-23 04:26:57 +00:00
info and help with test
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
defmodule PlantIdDiscordBotTest.Cog.Help do
|
||||
use ExUnit.Case
|
||||
|
||||
test "/help" do
|
||||
{:ok, response} = PlantIdDiscordBot.Cog.Info.help(%{data: %{name: "help"}})
|
||||
[embed] = response[:data][:embeds]
|
||||
assert match?(%Nostrum.Struct.Embed{}, embed)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
defmodule PlantIdDiscordBotTest.Cog.Invite do
|
||||
use ExUnit.Case
|
||||
|
||||
@invite Application.compile_env(:plantid_discord_bot, :invite)
|
||||
|
||||
test "/invite" do
|
||||
{:ok, response} = PlantIdDiscordBot.Cog.Info.invite(%{data: %{name: "invite"}})
|
||||
message = "Invite the bot to your server:\n\n[Click Here](#{@invite})"
|
||||
|
||||
expected_response = %{
|
||||
type: 4,
|
||||
data: %{content: message}
|
||||
}
|
||||
|
||||
assert response == expected_response
|
||||
end
|
||||
end
|
||||
@@ -3,14 +3,14 @@ defmodule PlantIdDiscordBotTest.Cog.Source do
|
||||
|
||||
@source Application.compile_env(:plantid_discord_bot, :source)
|
||||
|
||||
test "source" do
|
||||
interaction = %{data: %{name: "source"}}
|
||||
test "/source" do
|
||||
{:ok, response} = PlantIdDiscordBot.Cog.Info.source(%{data: %{name: "source"}})
|
||||
|
||||
expected_response = %{
|
||||
type: 4,
|
||||
data: %{content: @source}
|
||||
}
|
||||
|
||||
assert PlantIdDiscordBot.Cog.Info.source(interaction) == {:ok, expected_response}
|
||||
assert response == expected_response
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user