Skip to content

Commit

Permalink
Merge pull request #3620 from alphagov/update-schema-placeholder-refe…
Browse files Browse the repository at this point in the history
…rence

Updates placeholder schema references
  • Loading branch information
1pretz1 authored Sep 19, 2023
2 parents d48c02c + 8ac2b6a commit 59a8993
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions spec/components/machine_readable_metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def component_name
end

it "generates machine readable JSON-LD for articles" do
example = GovukSchemas::RandomExample.for_schema(frontend_schema: "generic")
example = GovukSchemas::RandomExample.for_schema(frontend_schema: "guide")
render_component(content_item: example, schema: :article)

json_linked_data = Nokogiri::HTML(rendered).css("script").text
Expand Down Expand Up @@ -60,7 +60,7 @@ def component_name
end

it "escapes harmful HTML in the JSON" do
example = GovukSchemas::RandomExample.for_schema(frontend_schema: "generic")
example = GovukSchemas::RandomExample.for_schema(frontend_schema: "guide")
example["description"] = bad_html

render_component(content_item: example, schema: :article)
Expand All @@ -76,7 +76,7 @@ def component_name
"bar" => bad_html,
},
}))
example = GovukSchemas::RandomExample.for_schema(frontend_schema: "generic")
example = GovukSchemas::RandomExample.for_schema(frontend_schema: "guide")

render_component(content_item: example, schema: :article)
json_linked_data = Nokogiri::HTML(rendered).css("script").text
Expand Down
4 changes: 2 additions & 2 deletions spec/features/contextual_navigation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def given_there_is_a_non_step_by_step_parent_page
end

def not_step_by_step_content
not_step_by_step_content = random_item("placeholder")
not_step_by_step_content = random_item("guide")
not_step_by_step_content["links"].delete("part_of_step_navs")
not_step_by_step_content["links"].delete("secondary_to_step_navs")
not_step_by_step_content
Expand All @@ -341,7 +341,7 @@ def given_there_is_a_parent_page_with_two_taxon
def given_there_is_a_parent_page_with_a_step_by_step
step_by_step = random_step_nav_item("step_by_step_nav").merge("title" => "A step by step page")

@parent = random_item("placeholder")
@parent = random_item("guide")
@parent["links"]["part_of_step_navs"] = [step_by_step]
@parent["links"].delete("finder")
end
Expand Down
2 changes: 1 addition & 1 deletion spec/features/step_nav_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
end
end

def content_store_has_random_item(base_path:, schema: "placeholder", part_of_step_navs: [])
def content_store_has_random_item(base_path:, schema: "guide", part_of_step_navs: [])
links = if part_of_step_navs
{ "part_of_step_navs" => part_of_step_navs }
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RSpec.describe GovukPublishingComponents::Presenters::ContentBreadcrumbsBasedOnAncestors do
describe "#breadcrumbs" do
it "can handle any valid content item" do
payload = GovukSchemas::RandomExample.for_schema(frontend_schema: "placeholder")
payload = GovukSchemas::RandomExample.for_schema(frontend_schema: "guide")

expect { described_class.new(payload).breadcrumbs }.to_not raise_error
end
Expand Down Expand Up @@ -87,7 +87,7 @@ def content_item_with_parents(parents)
end

def breadcrumbs_for(content_item)
fully_valid_content_item = GovukSchemas::RandomExample.for_schema(frontend_schema: "placeholder") do |random_item|
fully_valid_content_item = GovukSchemas::RandomExample.for_schema(frontend_schema: "guide") do |random_item|
random_item.merge(content_item)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ def payload_for(schema, content_item, context = nil)

describe "#related_navigation" do
it "can handle randomly generated content" do
expect { payload_for("placeholder", {}) }.to_not raise_error
expect { payload_for("guide", {}) }.to_not raise_error
end

it "returns empty arrays if there are no related navigation sidebar links" do
nothing = payload_for(
"placeholder",
"guide",
"details" => {
"external_related_links" => [],
},
Expand Down Expand Up @@ -219,7 +219,7 @@ def payload_for(schema, content_item, context = nil)

it "returns an Elsewhere on the web section for external related links" do
payload = payload_for(
"placeholder",
"guide",
"details" => {
"external_related_links" => [
{
Expand Down Expand Up @@ -262,7 +262,7 @@ def payload_for(schema, content_item, context = nil)

it "returns live taxons" do
payload = payload_for(
"placeholder",
"guide",
"details" => {
"external_related_links" => [],
},
Expand Down Expand Up @@ -308,7 +308,7 @@ def payload_for(schema, content_item, context = nil)
end

context "for a sidebar" do
subject(:payload) { payload_for("placeholder", {}, :sidebar) }
subject(:payload) { payload_for("guide", {}, :sidebar) }

it "only includes collections, guides and related items" do
expect(payload).to include(
Expand All @@ -329,7 +329,7 @@ def payload_for(schema, content_item, context = nil)
end

context "for a footer" do
subject(:payload) { payload_for("placeholder", {}, :footer) }
subject(:payload) { payload_for("guide", {}, :footer) }

it "only includes contacts external links, statistical datasets, topical events, topics and world locations" do
expect(payload).to include(
Expand Down

0 comments on commit 59a8993

Please sign in to comment.