-
Notifications
You must be signed in to change notification settings - Fork 222
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
Refactor selection box layer - Pass 1 #2667
Conversation
assert.strictEqual(sbl.boxVisible(), false, "Setting the boxVisible attribute to false works"); | ||
|
||
svg.remove(); | ||
}); |
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 crosses a very fine line of testing, but I have thinking about how to effectively test getters... only to end with the conclusion of not to test them directly (The best way to test them directly is to pull the corresponding variable backing the getter but then this leads into all sorts of trouble).
The best thing I can think of is to utilize the getters as our means of detecting correctness for the rest of the code (If we use a setter, then the getter should definitely reflect the set value) (If a state-modifying function is called, the getter should definitely reflect the modified state).
Sure we can use these unit tests to prove that the function exists, but I am unsure of its usefulness beyond that (Also this specific idea would be not useful for typescript consumers)
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.
As @jtlan was saying. We have to build up our tests on axioms. This tests proves that the getter and the setter are having the expected behavior, so we can use them later assuming they are correct.
I must agree that the usefulness of this test is below the average though.
A few suggestions |
I liked the idea of destroying the components, hence I applied it. Not sure what you mean about the getters / setters |
I think having tests to test the setters is perfectly valid, but I do not think it makes sense for us to explicitly say that we are testing the getters. Thus, in this scenario, I would say to change the test names to just saying that you can use the setters and then inside the test just use the getters to get at the set values. Something like |
Sounds good |
Refactor selection box layer tests - Pass 1
Part of #2623
I will be doing 2 passes because I will get more context (and better sense of best practices) by refactoring other files. However, please flag anything that seems unusual.
As part of this:
beforeEach()
clausesbeforeEach()
es