mirror of
https://github.com/TheRealOwenRees/plantid-discord-bot.git
synced 2026-07-22 20:16:57 +00:00
3e6116423a
* add up to 5 attachments * multiclause function event handler * fix incorrect Cog calls * add default param as "all" so we can start differentiating the types of identifications in the future - projects / diseases * abstract message sending * overwrite global application commands * pass message from projects to message sending and id functions
22 lines
668 B
Elixir
22 lines
668 B
Elixir
defmodule PlantIdDiscordBot.ErrorHandlingTest do
|
|
use ExUnit.Case
|
|
import ExUnit.CaptureLog
|
|
|
|
@guild Application.compile_env(:plantid_discord_bot, :guild)
|
|
|
|
test "do_identification/2 returns invokes logger on error" do
|
|
message = PlantNetFixtures.Message.message()
|
|
|
|
log =
|
|
capture_log(fn ->
|
|
PlantIdDiscordBot.Cog.PlantNetMessage.do_identification(message, "all")
|
|
|
|
assert_received {:create_message, 123_456,
|
|
content: "An error has occured. Please try again later."}
|
|
end)
|
|
|
|
assert log =~ "guild_id=#{message.guild_id}"
|
|
assert log =~ "guild_name=#{@guild.get_guild_name!(message.guild_id)}"
|
|
end
|
|
end
|