-
Notifications
You must be signed in to change notification settings - Fork 1
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
[NOREF] Initial MTO Milestone resolver tests #1548
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Clay! This looks great! I added some thoughts about other bits that could be tested, but they don't need to block this. Feel free to add or merge as is!
suite.NoError(err) | ||
suite.Len(categories, 2) // 1 new category (Operations) + Uncategorized | ||
|
||
operationsCategory, found := lo.Find(categories, func(item *models.MTOCategory) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that the resolver is merged in, I might suggest calling MTOCategoriesGetByID
to verify the category and subcategory. I do like that this is validating the category creation though!
Also fine to keep this the way it is since you are validating all categories for the MTO!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll see if I can simplify any of this using this new resolver :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm just going to add a comment for a potential change here -- I had a bit of trouble implementing MTOCategoriesGetByID
because I still ended up wanting to fetch the total list of categories/subcategories to ensure the proper number of categories existed post-creation (which MTOCategoriesGetByID
doesn't necessarily validate)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_, foundInternalFunctions := lo.Find(operationsSubCategories, func(item *models.MTOSubcategory) bool { | ||
return item != nil && item.Name == "Internal functions" | ||
}) | ||
suite.True(foundInternalFunctions) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be useful to validate a case where the subcategory already exists? Or that it will make a new category if you rename a category?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might add some TODO
comments to consider those cases! I didn't do those right away since I wanted to just kickstart these tests with the happy paths, but I agree these would be good test cases!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting to merge this until #1541 is in, since there'll be a lot of conflicts on this |
NOREF
Description
Important
This PR is purposefully not exhaustive - I just wanted to get some tests written for this resolver file so we had somewhere to write other tests, and to validate some of the more complex logic (like Common Milestones creating categories upon their instantiation)
How to test this change
pkg/graph/resolvers/mto_milestone_test.go
and make sure they all make sense and are readablePR Author Checklist
PR Reviewer Guidelines