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

Add regexTitle Filter #94

Merged
merged 13 commits into from
Nov 15, 2023
Merged

Add regexTitle Filter #94

merged 13 commits into from
Nov 15, 2023

Conversation

alxndr13
Copy link
Contributor

@alxndr13 alxndr13 commented Nov 1, 2023

  • fix: better error handling in the transformerfactory
  • fix: better error handling in the filterfactory
  • fix: add new filter 'regexTitle'
  • test: add test for 'regexTitle' filter
  • test: add test for 'allDayEvents' filter
  • test: add test for 'declinedEvents' filter

Copy link
Collaborator

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

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

The tests are pretty repetitive, please add a helper function to at least partially deduplicate the code.


filteredEvents := []models.Event{}

for _, event := range sourceEvents {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please extract that loop into a separate helper function together with the assert below. Then use that helper in all relevant tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done, had to add a "MockInterface" of the Filter Interface to prevent having an import loop. Is there an easier way to achieve this?

left the assert outside of the helper func, may want to use different asserts for different test cases in the future.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I've moved the FilterEvents helper into a filter_test package.

The alternative would be to somehow break the Filter interface out of the sync package, but I don't see an easy way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've moved the FilterEvents helper into a filter_test package.

That's what I did first, dismissed it as I thought introducing another package is not that clean 😂
Thanks!

The alternative would be to somehow break the Filter interface out of the sync package, but I don't see an easy way.

Yup, thought about this as well. Maybe we have to work on the whole code structure again, maybe I'll do that on a snowy winter day. But for now, this looks good.

@MichaelEischer
Copy link
Collaborator

@alxndr13 You've removed the last few commits which I had pushed 😕 . I guess that wasn't intended?

@alxndr13
Copy link
Contributor Author

alxndr13 commented Nov 9, 2023

@MichaelEischer damn, yup. that wasn't intended. sorry. Do you still have the commits locally? 😞

@MichaelEischer
Copy link
Collaborator

Yep, I've force pushed them :-)

@alxndr13
Copy link
Contributor Author

alxndr13 commented Nov 9, 2023

Now we should be good to go then :)

@MichaelEischer MichaelEischer merged commit 8107b89 into main Nov 15, 2023
@MichaelEischer MichaelEischer deleted the regexTitleFilter branch November 15, 2023 17:27
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