Skip to content

Commit

Permalink
Remove specialist example references
Browse files Browse the repository at this point in the history
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
  • Loading branch information
minhngocd committed Oct 1, 2024
1 parent 6e4e55a commit e9621f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 38 deletions.
30 changes: 1 addition & 29 deletions test/integration/specialist_document_test.rb
Original file line number Diff line number Diff line change
@@ -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")

Expand All @@ -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")

Expand Down
10 changes: 1 addition & 9 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = [{
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit e9621f7

Please sign in to comment.