2019-08-31 23:02:41 +00:00
|
|
|
defmodule FeedParserTest do
|
|
|
|
use ExUnit.Case
|
|
|
|
doctest FeedParser
|
2019-09-01 19:52:07 +00:00
|
|
|
|
|
|
|
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
|
2019-08-31 23:02:41 +00:00
|
|
|
end
|