41 lines
1.0 KiB
Elixir
41 lines
1.0 KiB
Elixir
defmodule Bright.XPostTest do
|
|
use Bright.DataCase
|
|
|
|
alias Bright.Socials.XPost
|
|
alias Bright.Vtubers.Vtuber
|
|
alias Bright.XPostsFixtures
|
|
|
|
@sample_feed "https://rss.app/feeds/FhPetvUY036xiFau.xml"
|
|
|
|
describe "x_posts" do
|
|
@tag :integration
|
|
test "get_new_posts/1 with URL" do
|
|
{:ok, posts} = XPost.get_new_posts(@sample_feed)
|
|
assert length(posts) > 0
|
|
end
|
|
|
|
@tag :integration
|
|
test "get_new_posts/1 with %Vtuber{}" do
|
|
vtuber = %Vtuber{twitter_rss: @sample_feed}
|
|
{:ok, posts} = XPost.get_new_posts(vtuber)
|
|
assert length(posts) > 0
|
|
end
|
|
end
|
|
|
|
describe "find_livestream_invitation" do
|
|
@tag :unit
|
|
test "identify posts with invitations" do
|
|
for post <- XPostsFixtures.x_posts_live() do
|
|
assert XPost.find_livestream_invitation(post) === true
|
|
end
|
|
end
|
|
|
|
@tag :unit
|
|
test "identify posts without invitations" do
|
|
for post <- XPostsFixtures.x_posts_offline() do
|
|
assert XPost.find_livestream_invitation(post) === false
|
|
end
|
|
end
|
|
end
|
|
end
|