From 6d37f52bccba9345cb19bce97793b3189982393b Mon Sep 17 00:00:00 2001 From: Simon Hughesdon Date: Fri, 14 Aug 2020 15:21:21 +0100 Subject: [PATCH] Add FAQ Page schema to detailed guides They are the same shape as answers, so we should be OK to reuse that template. --- app/views/content_items/detailed_guide.html.erb | 2 +- test/integration/detailed_guide_test.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/views/content_items/detailed_guide.html.erb b/app/views/content_items/detailed_guide.html.erb index bb082ff6f..f609e5fc9 100644 --- a/app/views/content_items/detailed_guide.html.erb +++ b/app/views/content_items/detailed_guide.html.erb @@ -1,6 +1,6 @@ <% content_for :extra_head_content do %> <%= machine_readable_metadata( - schema: :article + schema: :faq ) %> <% end %> diff --git a/test/integration/detailed_guide_test.rb b/test/integration/detailed_guide_test.rb index b4867e15f..f154ce320 100644 --- a/test/integration/detailed_guide_test.rb +++ b/test/integration/detailed_guide_test.rb @@ -85,4 +85,12 @@ class DetailedGuideTest < ActionDispatch::IntegrationTest assert page.has_css?(".metadata-logo[alt='European structural investment funds']") end + + test "renders FAQ structured data" do + setup_and_visit_content_item("detailed_guide") + faq_schema = find_structured_data(page, "FAQPage") + + assert_equal faq_schema["name"], @content_item["title"] + assert_not_equal faq_schema["mainEntity"], [] + end end