Skip to content

Commit f643a49

Browse files
committed
Note the limitations of the live content spec
This didn't surface validation issues introduced when adding in some compacting via the GraphqlContentItemService. On the world index, For example: - the schema requires a description property even if it's nil - the service would remove the property from the real content item because the description is nil - the test would include a description via the factory-generated edition, so we weren't testing the behaviour when the description is nil I tried using `GovukSchemas::RandomSchemaGenerator` to generate a more realistic content item, but it's only vaguely realistic. I tried adding a new strategy to the generator to produce a minimal valid content item, but it required significant processing to be in the right shape to pass into a FactoryBot `create` method. I tried PUTting it, but that requires some stubbing We still think this provides some value insofar as telling us if we produce all the expected fields when they are present in the edition, but we could introduce some other kind of processing in the future with which this might not catch issues, hence the note A more thorough approach when introducing new content types is to validate against a replicated database (real data) using `script/live_content/validate` (a bulk version is incoming)
1 parent d46f3da commit f643a49

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

spec/integration/graphql/live_content_spec.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
schema_name = query_filename.split(".").first
2424

2525
context "when the edition is a #{schema_name}" do
26-
it "produces a response that is valid against the schema" do
26+
# NOTE: this should not be taken as evidence that we produce a valid
27+
# response for real data. We can't guarantee that the factory-generated
28+
# edition looks like real data, so this won't catch certain issues
29+
it "can produce a response that is valid against the schema" do
2730
schema = GovukSchemas::Schema.find(frontend_schema: schema_name)
2831
document_type = schema.dig("properties", "document_type", "enum").sample
2932
edition = create(

0 commit comments

Comments
 (0)