Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Templetize tests #17

Merged
merged 10 commits into from
Apr 19, 2024
Merged

Templetize tests #17

merged 10 commits into from
Apr 19, 2024

Conversation

wilsonehusin
Copy link
Member

@wilsonehusin wilsonehusin commented Apr 19, 2024

I'm here to repay my sins of the terrible tests I wrote. I promised to do this before the next ticket at standup, because it would have been much messier PR without fixing these first.

Test files (both golden and mock API response) now all have conventions.

You can think of it like frontend snapshot testing — we should always produce exactly the same data (whether it's database entry or rendered Terraform) for the same input. Model structs, database rows, HCL — they are all just spicy JSON really.

This approach makes it easier to write tests, which hopefully incentivizes higher accuracy of tests, while still providing good signal on per test.

@wilsonehusin wilsonehusin marked this pull request as ready for review April 19, 2024 13:57
Copy link
Contributor

@AlexisJasso AlexisJasso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having now looked at the old tests in more detail, I see the improvements here and I like it.

@wilsonehusin wilsonehusin merged commit 7df8080 into main Apr 19, 2024
4 checks passed
@wilsonehusin wilsonehusin deleted the wh/templetize-tests branch April 19, 2024 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants