Skip to content

Commit

Permalink
Add test for weird world locations behaviour
Browse files Browse the repository at this point in the history
Added in to explain a bit of the oddity here since it could get lost in
the annals of time.
  • Loading branch information
kevindew committed Sep 26, 2018
1 parent fd4fb00 commit 2b3ddea
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/presenters/content_item/linkable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,22 @@ def initialize
expected_from_links = []
assert_equal expected_from_links, item.from
end

# World locations don't have links in the Publishing API payload
# This weird situation is explained here:
# - https://github.com/alphagov/government-frontend/pull/386
test "when a world location is linked to" do
item = DummyContentItem.new
item.content_item["links"]["world_locations"] = [
{
"title" => "Germany",
"base_path" => nil,
}
]

expected_from_links = [
%{<a href="/world/germany/news">Germany</a>}
]
assert_equal expected_from_links, item.part_of
end
end

0 comments on commit 2b3ddea

Please sign in to comment.