parent
2aab375928
commit
435284c01f
@ -1,21 +0,0 @@ |
||||
defmodule ExplorerWeb.SocialMediaLinksTest do |
||||
use ExplorerWeb.FeatureCase |
||||
|
||||
import Wallaby.Query |
||||
|
||||
test "it shows twitter when twitter is configured", %{session: session} do |
||||
Application.put_env(:explorer_web, ExplorerWeb.SocialMedia, twitter: "https://twitter.com/twitter") |
||||
|
||||
session |
||||
|> visit("/") |
||||
|> assert_has(css("[data-test='twitter_link']")) |
||||
end |
||||
|
||||
test "it hides twitter when twitter is not configured", %{session: session} do |
||||
Application.put_env(:explorer_web, ExplorerWeb.SocialMedia, facebook: "https://facebook.com/") |
||||
|
||||
session |
||||
|> visit("/") |
||||
|> refute_has(css("[data-test='twitter_link']")) |
||||
end |
||||
end |
@ -0,0 +1,25 @@ |
||||
defmodule ExplorerWeb.SocialMediaTest do |
||||
use Explorer.DataCase |
||||
|
||||
alias ExplorerWeb.SocialMedia |
||||
|
||||
test "it filters out unsupported services" do |
||||
Application.put_env( |
||||
:explorer_web, |
||||
ExplorerWeb.SocialMedia, |
||||
twitter: "MyTwitterProfile", |
||||
myspace: "MyAwesomeProfile" |
||||
) |
||||
|
||||
links = SocialMedia.links() |
||||
assert Keyword.has_key?(links, :twitter) |
||||
refute Keyword.has_key?(links, :myspace) |
||||
end |
||||
|
||||
test "it prepends the service url" do |
||||
Application.put_env(:explorer_web, ExplorerWeb.SocialMedia, twitter: "MyTwitterProfile") |
||||
|
||||
links = SocialMedia.links() |
||||
assert links[:twitter] == "https://www.twitter.com/MyTwitterProfile" |
||||
end |
||||
end |
Loading…
Reference in new issue