Add feed type detection tests

This commit is contained in:
Shadowfacts 2019-09-01 15:52:07 -04:00
parent 284f840613
commit dd9e30e15a
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 20 additions and 0 deletions

View File

@ -1,4 +1,24 @@
defmodule FeedParserTest do defmodule FeedParserTest do
use ExUnit.Case use ExUnit.Case
doctest FeedParser doctest FeedParser
test "parses atom feed" do
data = File.read!("test/fixtures/atom/feed.xml")
assert {:ok, %FeedParser.Feed{}} = FeedParser.parse(data, "application/xml")
end
test "parses rss2 feed" do
data = File.read!("test/fixtures/rss2/feed.xml")
assert {:ok, %FeedParser.Feed{}} = FeedParser.parse(data, "application/xml")
end
test "parses json feed" do
data = File.read!("test/fixtures/jsonfeed/feed.json")
assert {:ok, %FeedParser.Feed{}} = FeedParser.parse(data, "application/json")
end
test "parses rss-in-json feed" do
data = File.read!("test/fixtures/rssinjson/feed.json")
assert {:ok, %FeedParser.Feed{}} = FeedParser.parse(data, "application/json")
end
end end