mirror of
https://github.com/TheRealOwenRees/plantid-discord-bot.git
synced 2026-07-23 04:26:57 +00:00
response parser with tests
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
defmodule PlantIdDiscordBotTest.PlantNet.Parser do
|
||||
alias PlantIdDiscordBot.PlantNet.Parser
|
||||
use ExUnit.Case
|
||||
|
||||
doctest PlantIdDiscordBot.PlantNet.Parser
|
||||
|
||||
test "parse" do
|
||||
result =
|
||||
PlantNetFixtures.raw_response()
|
||||
|> Parser.parse()
|
||||
|
||||
assert result == PlantNetFixtures.parsed_response()
|
||||
end
|
||||
|
||||
test "filter by score" do
|
||||
result =
|
||||
PlantNetFixtures.parsed_response() |> Parser.filter_by_score()
|
||||
|
||||
assert result == PlantNetFixtures.parsed_response_filtered_by_score()
|
||||
end
|
||||
|
||||
test "add_external_urls" do
|
||||
result =
|
||||
PlantNetFixtures.parsed_response_filtered_by_score()
|
||||
|> Parser.add_external_urls()
|
||||
|
||||
assert result == PlantNetFixtures.parsed_response_with_urls()
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user