-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
I feel that the recommended method of testing dependent keys for computed properties is problematic for several reasons:
- Relying on the
_dependentKeysproperty is problematic since there is no guarantee it will exist in future Ember versions and in which case all of these tests would need to be rewritten. - The specificity of the tests provides little value since all a failing test tells us is that a dependent key was removed, in which case the developer would have removed the corresponding test anyway.
- Testing these directly in lieu of testing the resulting functionality provided by the dependent key being present has a high potential to leave gaps in our testing.
As an alternative, I feel that the emphasis should be on testing units of functionality rather than directly testing that specific properties are set. For example, if the desired functionality of a component is that a triggered action changes the value of a property on the component, the test should trigger the action then test that the value is what is expected. This way the component could be refactored and the tests still pass. If, on the other hand, the tests are too specific, they would all fail after a refactor and need to be rewritten. Then we have to ask ourselves why we are even writing tests in the first place.
Metadata
Metadata
Assignees
Labels
No labels