51 lines
1.4 KiB
Elixir
51 lines
1.4 KiB
Elixir
defmodule Frenzy.OPML.ExporterTest do
|
|
use ExUnit.Case
|
|
alias Frenzy.OPML.Exporter
|
|
alias Frenzy.{Feed, Group}
|
|
doctest Exporter
|
|
|
|
test "export groups" do
|
|
res =
|
|
Exporter.export([
|
|
%Group{
|
|
title: "Group 1",
|
|
feeds: [
|
|
%Feed{
|
|
feed_url: "https://shadowfacts.net/feed.xml",
|
|
site_url: "https://shadowfacts.net/",
|
|
title: "Shadowfacts"
|
|
}
|
|
]
|
|
},
|
|
%Group{
|
|
title: "Group 2",
|
|
feeds: [
|
|
%Feed{
|
|
feed_url: "some other url",
|
|
site_url: "my site",
|
|
title: "the title"
|
|
}
|
|
]
|
|
}
|
|
])
|
|
|
|
assert res ==
|
|
"""
|
|
<opml version="1.0">
|
|
<head>
|
|
<title>Frenzy export</title>
|
|
</head>
|
|
<body>
|
|
<outline text="Group 1" title="Group 1">
|
|
<outline htmlUrl="https://shadowfacts.net/" text="Shadowfacts" title="Shadowfacts" type="rss" xmlUrl="https://shadowfacts.net/feed.xml"/>
|
|
</outline>
|
|
<outline text="Group 2" title="Group 2">
|
|
<outline htmlUrl="my site" text="the title" title="the title" type="rss" xmlUrl="some other url"/>
|
|
</outline>
|
|
</body>
|
|
</opml>
|
|
"""
|
|
|> String.trim()
|
|
end
|
|
end
|