← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1493354] [NEW] Some angular unit tests use a wrong way of checking if an element exists

 

Public bug reported:

I've noticed a few occurrences of the following pattern in the Horizon
unit tests for Angular directives:
`expect(element.find(someSelector)).toBeDefined()`. That is going to
always true, since element.find(someSelector) returns an Array-like
object which _is_ defined. The correct pattern to use with such
selectors is `expect(element.find(someSelector).length).toBe(1)`.

** Affects: horizon
     Importance: Undecided
         Status: New


** Tags: unittest

** Tags added: unittest

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1493354

Title:
  Some angular unit tests use a wrong way of checking if an element
  exists

Status in OpenStack Dashboard (Horizon):
  New

Bug description:
  I've noticed a few occurrences of the following pattern in the Horizon
  unit tests for Angular directives:
  `expect(element.find(someSelector)).toBeDefined()`. That is going to
  always true, since element.find(someSelector) returns an Array-like
  object which _is_ defined. The correct pattern to use with such
  selectors is `expect(element.find(someSelector).length).toBe(1)`.

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1493354/+subscriptions


Follow ups