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

Specific importer tests are poorly scoped #2557

Open
kimadactyl opened this issue Aug 14, 2024 — with Huly for GitHub · 0 comments
Open

Specific importer tests are poorly scoped #2557

kimadactyl opened this issue Aug 14, 2024 — with Huly for GitHub · 0 comments

Comments

Copy link
Member

kimadactyl commented Aug 14, 2024

Description

Bug fixing things to do with the importer is tricky as there's a lot of tests that look a lot to me like magic number assertations. For example, this test asserts that there should be 15 events - why?

assert_equal 15, created_events.count

An example of why this is confusing is that if I remove the ! here, the event count changes from 15 to 17. I can't meaningfully reason about why.

events.select! { |ev| ev.valid? && ev.in_future? }

I think overall we need smaller and more specific unit tests for each stage of the process rather than these monolithic end to end ones.

Motivation

Importer logic is hard to reason about and test values seem arbritrary. This is a good recipe for introducing a lot of magic number bugs, and doesn't help us understand more about the code.

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

No branches or pull requests

1 participant