-
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
base: feature/MINT-3175_mto
Are you sure you want to change the base?
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 :)
_, 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!
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