Snapshot tests are inherently problematic because it is too easy to update snapshots when a snapshot test fails, which can lead to updating to incorrect snapshots; they can also give you a false sense of security when they're really just measuring that a view (usually the initial view) is the same as before. In addition to this general problem with snapshots, there is a problem specific to complaint manager 1.0, which is that the snapshots are saved in instance-files meaning any time you update them in one instance files and then switch orgs and update them again.
Because of these issues, I would like us to evaluate the snapshot tests as a team to determine which, if any, it is best to keep, and to make a plan to remove the rest from our codebase.
Current Snapshots
Client Side
SearchCasesPage
OfficerSearchResultsRow
DashboardAbout
DashboardDataSection
DashboardGlossary
ServerSide
generateComplainantLetterPdfBuffer
getReferralLetterPreview
generateLetterPdfBuffer
Best practice on when to use snapshots
Snapshot tests should test outputs (usually React components) that are primarily static (not a lot of forms, buttons, etc. that can change the view) and aren't expected to change that often. That way when a snapshot breaks you should be able to know immediately that your change had some unintended consequences in most cases.
Evaluate Snapshot Tests
Snapshot tests are inherently problematic because it is too easy to update snapshots when a snapshot test fails, which can lead to updating to incorrect snapshots; they can also give you a false sense of security when they're really just measuring that a view (usually the initial view) is the same as before. In addition to this general problem with snapshots, there is a problem specific to complaint manager 1.0, which is that the snapshots are saved in instance-files meaning any time you update them in one instance files and then switch orgs and update them again.
Because of these issues, I would like us to evaluate the snapshot tests as a team to determine which, if any, it is best to keep, and to make a plan to remove the rest from our codebase.
Current Snapshots
Client Side
ServerSide
Best practice on when to use snapshots
Snapshot tests should test outputs (usually React components) that are primarily static (not a lot of forms, buttons, etc. that can change the view) and aren't expected to change that often. That way when a snapshot breaks you should be able to know immediately that your change had some unintended consequences in most cases.