Skip to content

TESTING: Revisit testing of computed property dependent keys #60

@jonathandavidson

Description

@jonathandavidson

I feel that the recommended method of testing dependent keys for computed properties is problematic for several reasons:

  1. Relying on the _dependentKeys property 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.
  2. 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.
  3. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions