Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
feat: allow-developer-to-set-a-custom-refill-time-when-using-the #2114
base: main
Are you sure you want to change the base?
feat: allow-developer-to-set-a-custom-refill-time-when-using-the #2114
Changes from 15 commits
6ed290f
17e48c1
b14c926
8472e31
8d07b05
0904817
463f07d
ac4ccaf
2dce62d
2a76eb6
c35d5d3
f2647e1
85d2da3
ae98c89
29558b5
616d9a0
71c668c
da8b292
cb283dc
48635cd
6476ba5
e17617b
eb4df2e
d553e56
666c6a3
7446529
0997a90
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
what if
k.refillInterval
ismonthly
butk.refillDay
is null?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.
This should not ever happy. Monthly will default to 1 if No value. So we should never have a null value unless daily. But i gess we should check for it anyway.
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.
🛠️ Refactor suggestion
Improve test case clarity and remove unnecessary comment
The new test case is well-structured and follows the pattern of other tests in the file. However, consider the following improvements:
Make the test case name more specific to clearly indicate what invalid configuration is being tested. For example: "reject invalid refill config when daily interval has non-null refillDay".
Remove the unnecessary comment on line 126. It's outdated and doesn't provide any valuable information for this specific test case.
Consider using a more precise assertion for the error message. Instead of using
toMatchObject
, you could usetoEqual
for an exact match of the error object.Here's a suggested refactor:
These changes will improve the test case's clarity and maintainability.
📝 Committable suggestion
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.
Could you explain this test case to me?
Let me explain my thought process:
If this were to run today:
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.
why are we using the last day of a month as default?
also nitpick: move this out of the retry, it doesn't fail
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.
add test case please
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.
added
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.
this should use
ErrorResponse
as 2nd type param I think, I'm surprised this built at allThere 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.
Does this mean we should change all the other tests to match?
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.
all tests where you expect an error, yes
generally that's everything where we don't return a 200 status code
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.
Missing key creation step
The test is attempting to update a key without first creating it. This might lead to false positives if the error handling for non-existent keys is the same as for invalid refill configurations.
Consider adding a step to create the key before attempting to update it:
Then use this
keyId
in your update request.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.
Is this valid?
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.
@MichaelUnkey, thank you for bringing this to my attention. You're correct—the test is valid as is. The API validates the refill configuration before checking if the key exists, so the test correctly ensures that invalid refill configurations result in a 400 error, even if the key does not exist.
I apologize for any confusion my previous comment may have caused.
(_/)
(•_•)
I'm sorry for the confusion.
✏️ Learnings added
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.
🛠️ Refactor suggestion
Consider adding more test cases for refill functionality
The new test case for the default refill day is a great addition. To ensure comprehensive coverage of the refill functionality, consider adding the following test cases:
refillDay
provided (e.g., 15th of the month).refillDay
(e.g., 31 for a 30-day month).refillInterval
values (e.g., "weekly", "yearly") if supported.These additional test cases will help ensure the robustness of the refill functionality across various scenarios.