appuio / appuio-cloud-reporting

Reporting for APPUiO Cloud
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Add golden tests for creating invoices #57

Closed glrf closed 2 years ago

glrf commented 2 years ago

Summary

The current invoice tests are hard to extend as they build the complete database by hand and try to parse the complete invoice.

This PR introduces golden test for generating invoices. It uses the report function to fill the database with fake data and we compare the resulting invoice with a golden file. This still requires us to actually manually look at the created invoice but we should be able to spot errors that are introduced.

The test code is not especially more readable but it's a bit simpler to setup complex test cases. We handle a lot of edge cases we did not consider earlier.

See #55

Checklist

glrf commented 2 years ago

I introduce these golden test as part of the invoice test in ./pkg/invoice. We generally do more of an integration test and also test the reporting. Should this rather be moved to ./tests/ or similar?