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
Assert, getter function always fail with expecting a property #1090
Comments
It not feel right when expecting function to have property Any though @meeber , somehow expecting hope from you. Hopefully i mention on right time. |
Hey @brutalcrozt thanks for the issue. You're right, it is an awkward error message. We could perhaps look at improving this by adding an error message if you mix the arguments around. I'd be happy to see a PR of this nature! |
Assign me Cap, working on it. I have a question, the 3rd param was written |
It looks like you just need to throw when |
Hey folks, I'm not sure about the cases that are valid to throw here. What if we have a property in a function that we want to check instead of running it? This is a valid use-case and this is IMO what people would expect these assertions to do. For example: function myBook() {};
myBook.value = 10
function lowerValue() {
myBook.value -= 1
}
assert.decreasesBy(lowerValue, myBook, 'value', 1); This should not throw right? However, whenever a property name is not provided I see no problem in running the second argument if it is a function. |
Yet i am not trying throw anything.
It will fail with I just questioning what's documented, i don't have any appropriate step to take. Now i am confused, should discuss on issue or related PR then. I will follow any response for now. |
Since me and @keithamus are cleaning up issues I’ll close this because it will go into the roadmap. As I demonstrated before, asserting on properties of functions is a valid use case. I also mentioned that we can actually see if users did pass a property name or not by checking the number of arguments. If users pass 3 arguments then it means the third one is a value, not a property name (after all |
For the reproduction shake only
assert.decreasesBy
. See reproduction, line 16 pass; 18, 19 both fail.But i suspecting:
When use getter function, let me know if i am wrong.
Discovered when made #1085 to aim #1084.
The text was updated successfully, but these errors were encountered: