mirror of
https://github.com/TheRealOwenRees/plantid-discord-bot.git
synced 2026-07-23 04:26:57 +00:00
image saving with basic error handling
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
defmodule PlantIdDiscordBotTest.FileServer.File do
|
||||
use ExUnit.Case
|
||||
doctest PlantIdDiscordBot.FileServer.File
|
||||
|
||||
@image_path Application.compile_env(:plantid_discord_bot, :image_path)
|
||||
|
||||
test "generate_unique_filename" do
|
||||
file_path = PlantIdDiscordBot.FileServer.File.generate_unique_filename("jpg")
|
||||
file_name = Path.basename(file_path)
|
||||
assert Regex.match?(~r/^[0-9A-F]{16}\.jpg$/, file_name)
|
||||
assert file_path == Path.join(@image_path, file_name)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user