# {{product.name}}: unit test expectations, generated with ods/040_seed.sql and kept in step with it. # Read by the generic tests beside this file (test_*.py, copied unchanged from the template). # Run from the domain repository: uv run data-domain unit tables: # rows: how many rows the seed inserts # samples: seed rows checked by value in the ODS, through GraphQL and in the lake (the key # column is required; the first sample is also the row the reject updates target) # rejects: updates to the first sample that the ODS must refuse, with the constraint named in # PostgreSQL's error: __check for an enum, the constraint's own name for # a model constraint,
__fkey for a foreign key,
__key for # a unique column, "not-null" for NOT NULL # >>> repeat per entity table, in product.yaml order {{table}}: rows: {{seed_row_count}} samples: - {{table}}_id: {{seed_uuid}} {{column}}: {{seed_value}} # every column the seed row sets, quoted when YAML would retype it rejects: # >>> repeat per enum column, CHECK constraint, foreign key, unique and NOT NULL column - set: {{{column}}: {{invalid_value}}} violates: {{constraint_name}} # <<< end repeat # <<< end repeat # Relationship traversals documented in graphql/schema.graphql, checked against the seed: one per # relationship field the product exposes. `expect` must be contained in the response; lists # compare item by item, in order, so give nested collections an orderBy. graphql: # >>> repeat per relationship field - name: {{relationship_slug}} query: '{ {{entity}}Collection(filter: {{{entity}}Id: {eq: "{{seed_uuid}}"}}) { edges { node { {{relationship_field}} { {{camelColumn}} } } } } }' expect: {{entity}}Collection: {edges: [{node: {{{relationship_field}}: {{{camelColumn}}: {{seed_value}}}}}]} # <<< end repeat # One record published to an inbound topic and followed through every interface, then updated # and deleted through GraphQL. Pick a table without required foreign keys, and a key no seed row # uses. The test refuses to publish a record the ODS would reject, because a refused record stops # the product's Flink job. round_trip: table: {{table}} record: {{table}}_id: {{unused_uuid}} {{column}}: {{valid_value}} update: {{text_column}}: {{new_value}}