From e9621f77549611a4a1b747b99f3e02ad55e65b27 Mon Sep 17 00:00:00 2001 From: Minno Dang Date: Tue, 1 Oct 2024 21:49:27 +0100 Subject: [PATCH] Remove specialist example references so we can clean up example schemas. There is already a test that tests random generated examples of specialist document schemas render without error, so it feels a little redundant to test using the other examples too. Removing the test allows us to prune the example schemas from Publishing API --- test/integration/specialist_document_test.rb | 30 +------------------- test/test_helper.rb | 10 +------ 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/test/integration/specialist_document_test.rb b/test/integration/specialist_document_test.rb index 3b2bd5edd..0f0d6cf69 100644 --- a/test/integration/specialist_document_test.rb +++ b/test/integration/specialist_document_test.rb @@ -1,33 +1,13 @@ require "test_helper" class SpecialistDocumentTest < ActionDispatch::IntegrationTest - test "random but valid specialist documents do not error" do + test "random specialist document schema formats do not error" do setup_and_visit_random_content_item(document_type: "aaib_report") setup_and_visit_random_content_item(document_type: "raib_report") setup_and_visit_random_content_item(document_type: "tax_tribunal_decision") setup_and_visit_random_content_item(document_type: "cma_case") end - test "specialist document subtypes do not error" do - setup_and_visit_content_item("aaib-reports") - setup_and_visit_content_item("asylum-support-decision") - setup_and_visit_content_item("business-finance-support-scheme") - setup_and_visit_content_item("cma-cases") - setup_and_visit_content_item("countryside-stewardship-grants") - setup_and_visit_content_item("drug-safety-update") - setup_and_visit_content_item("employment-appeal-tribunal-decision") - setup_and_visit_content_item("employment-tribunal-decision") - setup_and_visit_content_item("european-structural-investment-funds") - setup_and_visit_content_item("eu-withdrawal-act-2018-statutory-instruments") - setup_and_visit_content_item("international-development-funding") - setup_and_visit_content_item("maib-reports") - setup_and_visit_content_item("raib-reports") - setup_and_visit_content_item("residential-property-tribunal-decision") - setup_and_visit_content_item("service-standard-report") - setup_and_visit_content_item("tax-tribunal-decision") - setup_and_visit_content_item("utaac-decision") - end - test "renders title, description and body" do setup_and_visit_content_item("aaib-reports") @@ -36,14 +16,6 @@ class SpecialistDocumentTest < ActionDispatch::IntegrationTest assert page.has_text?("The gyroplane began to move forward against the brakes before sufficient rotor rpm had been achieved for takeoff.") end - test "returns example for residential tribunal decision" do - setup_and_visit_content_item("residential-property-tribunal-decision") - - assert_has_component_title(@content_item["title"]) - assert page.has_text?(@content_item["description"]) - assert page.has_text?("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.") - end - test "renders from in publisher metadata" do setup_and_visit_content_item("aaib-reports") diff --git a/test/test_helper.rb b/test/test_helper.rb index 8980addc0..a54c7c71f 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -184,14 +184,6 @@ def setup_and_visit_html_publication(name, parameter_string = "") end end - def setup_and_visit_content_item_with_taxons(name, taxons) - @content_item = get_content_example(name).tap do |item| - item["links"]["taxons"] = taxons - stub_content_store_has_item(item["base_path"], item.to_json) - visit_with_cachebust(item["base_path"]) - end - end - def setup_and_visit_content_item_with_taxonomy_topic_email_override(name) @content_item = get_content_example(name).tap do |item| item["links"]["taxonomy_topic_email_override"] = [{ @@ -221,7 +213,7 @@ def setup_and_visit_a_page_with_specific_base_path(name, base_path, content_id = def setup_and_visit_random_content_item(document_type: nil) content_item = GovukSchemas::RandomExample.for_schema(frontend_schema: schema_type) do |payload| - payload.merge!("document_type" => document_type) unless document_type.nil? + payload.merge!("document_type" => document_type) if document_type payload end