Skip to content

test: add semantic assertions to test_generated_structured_file_snapshots #34

@coderabbitai

Description

@coderabbitai

Summary

The test_generated_structured_file_snapshots test in tests/test_template.py relies solely on syrupy snapshot comparison. Snapshot comparison is bare — it verifies that output has not changed but does not assert specific behavioural contracts on the generated files (e.g. Makefile targets, CI workflow structure, Cargo metadata fields).

Problem

If a snapshot is regenerated (e.g. after an intentional template change), there is no safety net of focused assertions to confirm that the contracts that matter — Makefile phony targets, CI checkout/nextest/coverage steps, Cargo [package] and [package.metadata.binstall] fields — are still correct. A snapshot regeneration could silently swallow a regression.

Proposed Action

Add focused assertions inside test_generated_structured_file_snapshots, paired with the snapshot comparison, to exercise:

  • Makefile contracts — presence of expected phony targets (e.g. all, test, lint, coverage)
  • CI workflow contracts — expected job steps (e.g. checkout, nextest install, Whitaker cache, coverage upload)
  • Cargo metadata contracts[package] fields (description, repository, homepage, keywords, categories) and, for the app flavour, [package.metadata.binstall] fields

These are the same contract categories exercised by assert_makefile_contracts, assert_ci_workflow_contracts, and assert_cargo_contracts in test_generated_tooling_contracts. Reuse or call those helpers directly where appropriate.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions